[tf2tflite] Enable moco logs via TF2TFLITE_Log_Frontend (#7040)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 30 Aug 2019 00:04:32 +0000 (09:04 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 30 Aug 2019 00:04:32 +0000 (09:04 +0900)
Let's use TF2TFLITE_Log_Frontend instead of MOCO_LOG.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
compiler/tf2tflite/CMakeLists.txt
compiler/tf2tflite/src/Driver.cpp

index 872c82a..05447d6 100644 (file)
@@ -33,6 +33,7 @@ target_link_libraries(tf2tflite_customop_info_proto PUBLIC libprotobuf)
 file(GLOB_RECURSE SOURCES "src/*.cpp")
 
 add_executable(tf2tflite ${SOURCES})
+target_link_libraries(tf2tflite PRIVATE moco_log)
 target_link_libraries(tf2tflite PRIVATE moco_tf_frontend)
 target_link_libraries(tf2tflite PRIVATE nnkit_support_tftestinfo)
 target_link_libraries(tf2tflite PRIVATE exo_tflite)
index 26d01d8..9ae080c 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "CustomopConfLoader.h"
 
+#include <moco/LoggingContext.h>
 #include <moco/tf/Frontend.h>
 #include <exo/TFLExporter.h>
 
@@ -91,6 +92,11 @@ void print_help()
 
 int main(int argc, char **argv)
 {
+  using EnvConfig = hermes::EnvConfig<hermes::EnvFormat::BooleanNumber>;
+
+  // This line allows users to control all the moco-tf loggers via TF2TFLITE_Log_Frontend
+  moco::LoggingContext::get()->config(stdex::make_unique<EnvConfig>("TF2TFLITE_Log_Frontend"));
+
   LOGGER(l);
 
   // TODO We need better args parsing in future