From 08446976e3b6ce0e02f22b391b37aacaad181e1a Mon Sep 17 00:00:00 2001 From: Derek Lamberti Date: Tue, 26 Nov 2019 16:38:31 +0000 Subject: Replace boost logging with simple logger !referencetests:214319 * Reduces arm nn binary size ~15% * Also fixed test logging black hole issues Change-Id: Iba27db304d9a8088fa46aeb0b52225d93bb56bc8 Signed-off-by: Derek Lamberti --- src/armnnUtils/Logging.cpp | 99 ---------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 src/armnnUtils/Logging.cpp (limited to 'src/armnnUtils/Logging.cpp') diff --git a/src/armnnUtils/Logging.cpp b/src/armnnUtils/Logging.cpp deleted file mode 100644 index 10f32dcbef..0000000000 --- a/src/armnnUtils/Logging.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright © 2017 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// -#include "Logging.hpp" - -#include -#include - -#if defined(_MSC_VER) -#include -#endif - -#if defined(__ANDROID__) -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -namespace armnnUtils -{ - -struct DebugOutputSink : boost::log::sinks::basic_formatted_sink_backend -{ - void consume(boost::log::record_view const& rec, std::string const& formatted_message) - { -#if defined(_MSC_VER) - OutputDebugString(formatted_message.c_str()); - OutputDebugString("\n"); -#endif -#if defined(__ANDROID__) - __android_log_write(ANDROID_LOG_DEBUG, "armnn", formatted_message.c_str()); -#endif - } -}; - -void ConfigureLogging(boost::log::core* core, bool printToStandardOutput, bool printToDebugOutput, - armnn::LogSeverity severity) -{ - // Even if we remove all the sinks, Boost will fallback to the 'default sink' and still print stuff to - // stdout, so we have to explicitly disable logging in this case. - core->set_logging_enabled(printToStandardOutput || printToDebugOutput); - - // Sets up severity filter. - boost::log::trivial::severity_level boostSeverity; - switch (severity) - { - case armnn::LogSeverity::Trace: - boostSeverity = boost::log::trivial::trace; - break; - case armnn::LogSeverity::Debug: - boostSeverity = boost::log::trivial::debug; - break; - case armnn::LogSeverity::Info: - boostSeverity = boost::log::trivial::info; - break; - case armnn::LogSeverity::Warning: - boostSeverity = boost::log::trivial::warning; - break; - case armnn::LogSeverity::Error: - boostSeverity = boost::log::trivial::error; - break; - case armnn::LogSeverity::Fatal: - boostSeverity = boost::log::trivial::fatal; - break; - default: - BOOST_ASSERT_MSG(false, "Invalid severity"); - } - core->set_filter(boost::log::trivial::severity >= boostSeverity); - - core->remove_all_sinks(); - if (printToStandardOutput) - { - typedef boost::log::sinks::basic_text_ostream_backend backend_t; - boost::shared_ptr backend = boost::make_shared(); - - boost::shared_ptr> stream(&std::cout, boost::null_deleter()); - backend->add_stream(stream); - - typedef boost::log::sinks::synchronous_sink sink_t; - boost::shared_ptr standardOutputSink = boost::make_shared(backend); - - core->add_sink(standardOutputSink); - } - if (printToDebugOutput) - { - typedef boost::log::sinks::synchronous_sink sink_t; - boost::shared_ptr debugOutputSink(new sink_t()); - core->add_sink(debugOutputSink); - } -} - -} -- cgit v1.2.1