From aad5a650d44d350423b7d61412922657c93f603a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 21 Jun 2019 15:49:30 +0900 Subject: [PATCH] [moco-log] Use Builtin Hermes Console Reporter (#3914) This commit replaces locally-implemented reporter with the one in hermes-std module. Signed-off-by: Jonghyun Park --- contrib/moco-log/CMakeLists.txt | 1 + contrib/moco-log/requires.cmake | 1 + contrib/moco-log/src/Log.cpp | 20 ++------------------ 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/contrib/moco-log/CMakeLists.txt b/contrib/moco-log/CMakeLists.txt index 8b46cdf..bbf3dfe 100644 --- a/contrib/moco-log/CMakeLists.txt +++ b/contrib/moco-log/CMakeLists.txt @@ -4,4 +4,5 @@ file(GLOB_RECURSE SOURCES "src/*.cpp") add_library(moco_log SHARED ${SOURCES}) target_include_directories(moco_log PUBLIC include) target_link_libraries(moco_log PUBLIC hermes) +target_link_libraries(moco_log PRIVATE hermes_std) target_link_libraries(moco_log PRIVATE stdex) diff --git a/contrib/moco-log/requires.cmake b/contrib/moco-log/requires.cmake index 69d38ec..657aa04 100644 --- a/contrib/moco-log/requires.cmake +++ b/contrib/moco-log/requires.cmake @@ -1 +1,2 @@ require("hermes") +require("hermes-std") diff --git a/contrib/moco-log/src/Log.cpp b/contrib/moco-log/src/Log.cpp index da1583b..52f8e2e 100644 --- a/contrib/moco-log/src/Log.cpp +++ b/contrib/moco-log/src/Log.cpp @@ -1,5 +1,6 @@ #include "moco/Log.h" +#include #include #include @@ -24,23 +25,6 @@ template <> bool safecast(const char *s, const bool &value) } // namespace -namespace -{ - -// NOTE Not thread-safe -struct ConsoleReporter final : public hermes::Sink -{ - void notify(const hermes::Message *m) override - { - for (uint32_t n = 0; n < m->text()->lines(); ++n) - { - std::cout << m->text()->line(n) << std::endl; - } - } -}; - -} // namespace - // // Logger // @@ -102,7 +86,7 @@ hermes::Context *LoggingContext::get(void) if (ctx == nullptr) { ctx = new hermes::Context; - ctx->sinks()->append(stdex::make_unique()); + ctx->sinks()->append(stdex::make_unique()); ctx->config(stdex::make_unique()); } -- 2.7.4