Lines Matching refs:writer
186 void WriteLogFor(CodeWriter& writer, const AidlTypeSpecifier& type, const std::string& name, in WriteLogFor() argument
195 writer << log << " = Json::Value(Json::arrayValue);\n"; in WriteLogFor()
196 writer << "for (const auto& v: " << var_object_expr << ") " << log << ".append("; in WriteLogFor()
197 info.toJsonValueExpr(writer, "v", isNdk); in WriteLogFor()
198 writer << ");"; in WriteLogFor()
200 writer << log << " = "; in WriteLogFor()
201 info.toJsonValueExpr(writer, var_object_expr, isNdk); in WriteLogFor()
202 writer << ";"; in WriteLogFor()
204 writer << "\n"; in WriteLogFor()
207 void WriteLogForArguments(CodeWriterPtr& writer, const AidlArgument& a, bool isServer, in WriteLogForArguments() argument
213 (*writer) << "{\n"; in WriteLogForArguments()
214 (*writer).Indent(); in WriteLogForArguments()
215 (*writer) << "Json::Value " << logElementVarName << "(Json::objectValue);\n"; in WriteLogForArguments()
217 (*writer) << logElementVarName << "[\"name\"] = \"" << varName << "\";\n"; in WriteLogForArguments()
220 WriteLogFor(*(writer.get()), a.GetType(), varName, isPointer, logElementVarName + "[\"value\"]", in WriteLogForArguments()
222 (*writer) << logVarName << ".append(" << logElementVarName << ");\n"; in WriteLogForArguments()
223 (*writer) << "}\n"; in WriteLogForArguments()
224 (*writer).Dedent(); in WriteLogForArguments()
230 CodeWriterPtr writer = CodeWriter::ForString(&code); in GenLogBeforeExecute() local
231 (*writer) << "Json::Value _log_input_args(Json::arrayValue);\n"; in GenLogBeforeExecute()
233 (*writer) << "if (" << className << "::logFunc != nullptr) {\n"; in GenLogBeforeExecute()
234 (*writer).Indent(); in GenLogBeforeExecute()
238 WriteLogForArguments(writer, *a, isServer, "_log_input_args", isNdk); in GenLogBeforeExecute()
242 (*writer).Dedent(); in GenLogBeforeExecute()
243 (*writer) << "}\n"; in GenLogBeforeExecute()
245 (*writer) << "auto _log_start = std::chrono::steady_clock::now();\n"; in GenLogBeforeExecute()
246 writer->Close(); in GenLogBeforeExecute()
254 CodeWriterPtr writer = CodeWriter::ForString(&code); in GenLogAfterExecute() local
256 (*writer) << "if (" << className << "::logFunc != nullptr) {\n"; in GenLogAfterExecute()
257 (*writer).Indent(); in GenLogAfterExecute()
291 (*writer) << "auto _log_end = std::chrono::steady_clock::now();\n"; in GenLogAfterExecute()
292 (*writer) << "Json::Value _log_transaction(Json::objectValue);\n"; in GenLogAfterExecute()
293 (*writer) << "_log_transaction[\"duration_ms\"] = " in GenLogAfterExecute()
296 (*writer) << "_log_transaction[\"interface_name\"] = " in GenLogAfterExecute()
298 (*writer) << "_log_transaction[\"method_name\"] = " in GenLogAfterExecute()
301 (*writer) << "_log_transaction[\"" << (isServer ? "stub_address" : "proxy_address") << "\"] = "; in GenLogAfterExecute()
302 (*writer) << "Json::Value(" in GenLogAfterExecute()
306 (*writer) << "_log_transaction[\"input_args\"] = _log_input_args;\n"; in GenLogAfterExecute()
307 (*writer) << "Json::Value _log_output_args(Json::arrayValue);\n"; in GenLogAfterExecute()
309 (*writer) << "Json::Value _log_status(Json::objectValue);\n"; in GenLogAfterExecute()
311 (*writer) << "_log_status[\"exception_code\"] = Json::Value(AStatus_getExceptionCode(" in GenLogAfterExecute()
313 (*writer) << "_log_status[\"exception_message\"] = Json::Value(AStatus_getMessage(" in GenLogAfterExecute()
315 (*writer) << "_log_status[\"transaction_error\"] = Json::Value(AStatus_getStatus(" in GenLogAfterExecute()
317 (*writer) << "_log_status[\"service_specific_error_code\"] = " in GenLogAfterExecute()
321 (*writer) << "_log_status[\"exception_code\"] = Json::Value(" << statusVarName in GenLogAfterExecute()
323 (*writer) << "_log_status[\"exception_message\"] = Json::Value(" << statusVarName in GenLogAfterExecute()
325 (*writer) << "_log_status[\"transaction_error\"] = Json::Value(" << statusVarName in GenLogAfterExecute()
327 (*writer) << "_log_status[\"service_specific_error_code\"] = Json::Value(" << statusVarName in GenLogAfterExecute()
331 (*writer) << "_log_transaction[\"binder_status\"] = _log_status;\n"; in GenLogAfterExecute()
334 WriteLogForArguments(writer, *a, isServer, "_log_output_args", isNdk); in GenLogAfterExecute()
337 (*writer) << "_log_transaction[\"output_args\"] = _log_output_args;\n"; in GenLogAfterExecute()
340 WriteLogFor(*(writer.get()), method.GetType(), returnVarName, !isServer, in GenLogAfterExecute()
346 (*writer) << className << "::logFunc(_log_transaction);\n"; in GenLogAfterExecute()
348 (*writer).Dedent(); in GenLogAfterExecute()
349 (*writer) << "}\n"; in GenLogAfterExecute()
351 writer->Close(); in GenLogAfterExecute()