Replace boost logging with simple logger
authorDerek Lamberti <derek.lamberti@arm.com>
Tue, 26 Nov 2019 16:38:31 +0000 (16:38 +0000)
committerDerek Lamberti <derek.lamberti@arm.com>
Thu, 5 Dec 2019 15:35:51 +0000 (15:35 +0000)
!referencetests:214319

* Reduces arm nn binary size ~15%
* Also fixed test logging black hole issues

Change-Id: Iba27db304d9a8088fa46aeb0b52225d93bb56bc8
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
53 files changed:
Android.mk
CMakeLists.txt
include/armnn/ArmNN.hpp
include/armnn/Logging.hpp [new file with mode: 0644]
include/armnn/Utils.hpp
src/armnn/Descriptors.cpp
src/armnn/Graph.cpp
src/armnn/Layer.cpp
src/armnn/LoadedNetwork.cpp
src/armnn/Network.cpp
src/armnn/Runtime.cpp
src/armnn/Tensor.cpp
src/armnn/Utils.cpp
src/armnn/test/ModelAccuracyCheckerTest.cpp
src/armnn/test/UnitTests.cpp
src/armnn/test/UnitTests.hpp
src/armnnCaffeParser/CaffeParser.cpp
src/armnnConverter/ArmnnConverter.cpp
src/armnnDeserializer/Deserializer.cpp
src/armnnTfLiteParser/TfLiteParser.cpp
src/armnnUtils/Logging.cpp [deleted file]
src/armnnUtils/Logging.hpp [deleted file]
src/armnnUtils/ModelAccuracyChecker.cpp
src/backends/backendsCommon/DynamicBackendUtils.cpp
src/backends/backendsCommon/OutputHandler.cpp
src/backends/cl/ClBackendContext.cpp
src/backends/cl/ClContextControl.cpp
src/backends/cl/ClWorkloadFactory.cpp
src/backends/reference/RefWorkloadFactory.cpp
src/backends/reference/workloads/Activation.cpp
src/backends/reference/workloads/RefNormalizationWorkload.cpp
src/profiling/CommandHandler.cpp
src/profiling/PeriodicCounterCapture.cpp
src/profiling/ProfilingService.cpp
src/profiling/test/ProfilingTests.hpp
tests/CaffePreprocessor.cpp
tests/Cifar10Database.cpp
tests/DeepSpeechV1Database.hpp
tests/DeepSpeechV1InferenceTest.hpp
tests/ExecuteNetwork/ExecuteNetwork.cpp
tests/ImageTensorGenerator/ImageTensorGenerator.cpp
tests/InferenceModel.hpp
tests/InferenceTest.cpp
tests/InferenceTest.hpp
tests/InferenceTest.inl
tests/MnistDatabase.cpp
tests/MobileNetSsdDatabase.hpp
tests/MobileNetSsdInferenceTest.hpp
tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
tests/YoloDatabase.cpp
tests/YoloInferenceTest.hpp

index 4dc023ecaf05c8fc97d3f2dfc52697afca080a0c..5439ef370555fcd894827f61b52e43304c4d79d9 100644 (file)
@@ -111,7 +111,6 @@ LOCAL_SRC_FILES := \
         src/armnnUtils/FloatingPointConverter.cpp \
         src/armnnUtils/HeapProfiling.cpp \
         src/armnnUtils/LeakChecking.cpp \
-        src/armnnUtils/Logging.cpp \
         src/armnnUtils/ParserHelper.cpp \
         src/armnnUtils/Permute.cpp \
         src/armnnUtils/TensorUtils.cpp \
index b05f5064070ac2eaebf4746268d9d19ecd145c0b..369ffcfe76787741728419088368313dec6815b9 100644 (file)
@@ -42,8 +42,6 @@ list(APPEND armnnUtils_sources
     include/armnnUtils/TensorUtils.hpp
     src/armnnUtils/GraphTopologicalSort.hpp
     src/armnnUtils/Half.hpp
-    src/armnnUtils/Logging.hpp
-    src/armnnUtils/Logging.cpp
     src/armnnUtils/Permute.cpp
     src/armnnUtils/DataLayoutIndexed.cpp
     src/armnnUtils/DotSerializer.cpp
@@ -93,7 +91,7 @@ if(BUILD_CAFFE_PARSER)
 
     target_include_directories(armnnCaffeParser PRIVATE src/armnnUtils)
 
-    target_link_libraries(armnnCaffeParser ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+    target_link_libraries(armnnCaffeParser ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY})
 
     target_link_libraries(armnnCaffeParser armnn)
     target_link_libraries(armnnCaffeParser ${PROTOBUF_LIBRARIES})
@@ -178,7 +176,6 @@ if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
             ${Boost_SYSTEM_LIBRARY}
             ${Boost_PROGRAM_OPTIONS_LIBRARY}
             ${Boost_FILESYSTEM_LIBRARY}
-            ${Boost_LOG_LIBRARY}
             ${Boost_THREAD_LIBRARY} )
 
     add_executable_ex(ArmnnQuantizer
@@ -191,7 +188,6 @@ if(BUILD_ARMNN_QUANTIZER AND ARMNNREF)
             ${Boost_SYSTEM_LIBRARY}
             ${Boost_PROGRAM_OPTIONS_LIBRARY}
             ${Boost_FILESYSTEM_LIBRARY}
-            ${Boost_LOG_LIBRARY}
             ${Boost_THREAD_LIBRARY} )
 
     target_link_libraries(ArmnnQuantizer
@@ -227,6 +223,7 @@ list(APPEND armnn_sources
     include/armnn/IRuntime.hpp
     include/armnn/LayerSupport.hpp
     include/armnn/LayerVisitorBase.hpp
+    include/armnn/Logging.hpp
     include/armnn/LstmParams.hpp
     include/armnn/MemorySources.hpp
     include/armnn/NetworkFwd.hpp
@@ -554,7 +551,7 @@ endif()
 
 install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
-target_link_libraries(armnn ${Boost_LOG_LIBRARY} ${Boost_THREAD_LIBRARY}
+target_link_libraries(armnn ${Boost_THREAD_LIBRARY}
                             ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
 
 if(ARMCOMPUTENEON OR ARMCOMPUTECL)
index b18f14c8b768fdf835046b5ea68a765ddcea1f10..119520b7c9c8040b28f48b0f8499b34e4708487b 100644 (file)
@@ -9,6 +9,7 @@
 #include "Exceptions.hpp"
 #include "INetwork.hpp"
 #include "IRuntime.hpp"
+#include "Logging.hpp"
 #include "LstmParams.hpp"
 #include "Optional.hpp"
 #include "QuantizedLstmParams.hpp"
diff --git a/include/armnn/Logging.hpp b/include/armnn/Logging.hpp
new file mode 100644 (file)
index 0000000..9bf086b
--- /dev/null
@@ -0,0 +1,300 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <iostream>
+
+#include "Utils.hpp"
+
+
+#if defined(_MSC_VER)
+#include <Windows.h>
+#endif
+
+#if defined(__ANDROID__)
+#include <android/log.h>
+#endif
+
+#include <boost/assert.hpp>
+
+
+namespace armnn
+{
+
+inline std::string LevelToString(LogSeverity level)
+{
+    switch(level)
+    {
+        case LogSeverity::Trace:
+            return "Trace";
+        case LogSeverity::Debug:
+            return "Debug";
+        case LogSeverity::Info:
+            return "Info";
+        case LogSeverity::Warning:
+            return "Warning";
+        case LogSeverity::Error:
+            return "Error";
+        case LogSeverity::Fatal:
+            return "Fatal";
+        default:
+            return "Log";
+    }
+}
+
+class LogSink
+{
+public:
+    virtual ~LogSink(){};
+
+    virtual void Consume(const std::string& s) = 0;
+private:
+
+};
+
+class StandardOutputColourSink : public LogSink
+{
+public:
+    StandardOutputColourSink(LogSeverity level = LogSeverity::Info)
+    : m_Level(level)
+    {
+    }
+
+    void Consume(const std::string& s) override
+    {
+        std::cout << GetColour(m_Level) << s << ResetColour() << std::endl;
+    }
+
+private:
+    std::string ResetColour()
+    {
+        return "\033[0m";
+    }
+
+    std::string GetColour(LogSeverity level)
+    {
+        switch(level)
+        {
+            case LogSeverity::Trace:
+                return "\033[35m";
+            case LogSeverity::Debug:
+                return "\033[32m";
+            case LogSeverity::Info:
+                return "\033[0m";
+            case LogSeverity::Warning:
+                return "\033[33m";
+            case LogSeverity::Error:
+                return "\033[31m";
+            case LogSeverity::Fatal:
+                return "\033[41;30m";
+
+            default:
+                return "\033[0m";
+        }
+    }
+    LogSeverity m_Level;
+};
+
+class StandardOutputSink : public LogSink
+{
+public:
+    void Consume(const std::string& s) override
+    {
+        std::cout << s << std::endl;
+    }
+};
+
+class DebugOutputSink : public LogSink
+{
+public:
+    void Consume(const std::string& s) override
+    {
+#if defined(_MSC_VER)
+        OutputDebugString(s.c_str());
+        OutputDebugString("\n");
+#endif
+#if defined(__ANDROID__)
+        __android_log_write(ANDROID_LOG_DEBUG, "armnn", s.c_str());
+#endif
+    }
+};
+
+struct ScopedRecord
+{
+    ScopedRecord(const std::vector<std::shared_ptr<LogSink>>& sinks, LogSeverity level, bool enabled)
+    : m_LogSinks(sinks)
+    , m_Enabled(enabled)
+    {
+        if (enabled)
+        {
+            m_Os << LevelToString(level) << ": ";
+        }
+    }
+
+    ~ScopedRecord()
+    {
+        if (m_Enabled)
+        {
+            for (auto sink : m_LogSinks)
+            {
+                if (sink)
+                {
+                    sink->Consume(m_Os.str());
+                }
+            }
+        }
+    }
+
+    ScopedRecord(const ScopedRecord&) = delete;
+    ScopedRecord& operator=(const ScopedRecord&) = delete;
+    ScopedRecord(ScopedRecord&& other) = default;
+    ScopedRecord& operator=(ScopedRecord&&) = default;
+
+    template<typename Streamable>
+    ScopedRecord& operator<<(const Streamable& s)
+    {
+        if (m_Enabled)
+        {
+            m_Os << s;
+        }
+        return (*this);
+    }
+
+private:
+    const std::vector<std::shared_ptr<LogSink>>& m_LogSinks;
+    std::ostringstream m_Os;
+    bool m_Enabled;
+};
+
+template<LogSeverity Level>
+class SimpleLogger
+{
+public:
+    SimpleLogger()
+        : m_Sinks{std::make_shared<StandardOutputSink>()}
+        , m_Enable(true)
+    {
+    }
+
+    static SimpleLogger& Get()
+    {
+        static SimpleLogger<Level> logger;
+        return logger;
+    }
+
+    void Enable(bool enable = true)
+    {
+        m_Enable = enable;
+    }
+
+    ScopedRecord StartNewRecord()
+    {
+        ScopedRecord record(m_Sinks, Level, m_Enable);
+        return record;
+    }
+
+    void RemoveAllSinks()
+    {
+        m_Sinks.clear();
+    }
+
+    void AddSink(std::shared_ptr<LogSink> sink)
+    {
+        m_Sinks.push_back(sink);
+    }
+private:
+    std::vector<std::shared_ptr<LogSink>> m_Sinks;
+    bool m_Enable;
+};
+
+inline void SetLogFilter(LogSeverity level)
+{
+    SimpleLogger<LogSeverity::Trace>::Get().Enable(false);
+    SimpleLogger<LogSeverity::Debug>::Get().Enable(false);
+    SimpleLogger<LogSeverity::Info>::Get().Enable(false);
+    SimpleLogger<LogSeverity::Warning>::Get().Enable(false);
+    SimpleLogger<LogSeverity::Error>::Get().Enable(false);
+    SimpleLogger<LogSeverity::Fatal>::Get().Enable(false);
+    switch (level)
+    {
+        case LogSeverity::Trace:
+            SimpleLogger<LogSeverity::Trace>::Get().Enable(true);
+            ARMNN_FALLTHROUGH;
+        case LogSeverity::Debug:
+            SimpleLogger<LogSeverity::Debug>::Get().Enable(true);
+            ARMNN_FALLTHROUGH;
+        case LogSeverity::Info:
+            SimpleLogger<LogSeverity::Info>::Get().Enable(true);
+            ARMNN_FALLTHROUGH;
+        case LogSeverity::Warning:
+            SimpleLogger<LogSeverity::Warning>::Get().Enable(true);
+            ARMNN_FALLTHROUGH;
+        case LogSeverity::Error:
+            SimpleLogger<LogSeverity::Error>::Get().Enable(true);
+            ARMNN_FALLTHROUGH;
+        case LogSeverity::Fatal:
+            SimpleLogger<LogSeverity::Fatal>::Get().Enable(true);
+            break;
+        default:
+            BOOST_ASSERT(false);
+    }
+}
+
+template<LogSeverity Level>
+inline void SetLoggingSinks(bool standardOut, bool debugOut, bool coloured)
+{
+    SimpleLogger<Level>::Get().RemoveAllSinks();
+
+    if (standardOut)
+    {
+        if (coloured)
+        {
+            SimpleLogger<Level>::Get().AddSink(
+                std::make_shared<StandardOutputColourSink>(Level));
+        } else
+        {
+            SimpleLogger<Level>::Get().AddSink(
+                std::make_shared<StandardOutputSink>());
+        }
+    }
+
+    if (debugOut)
+    {
+        SimpleLogger<Level>::Get().AddSink(
+            std::make_shared<DebugOutputSink>());
+    }
+}
+
+inline void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
+{
+    SetLoggingSinks<LogSeverity::Trace>(standardOut, debugOut, coloured);
+    SetLoggingSinks<LogSeverity::Debug>(standardOut, debugOut, coloured);
+    SetLoggingSinks<LogSeverity::Info>(standardOut, debugOut, coloured);
+    SetLoggingSinks<LogSeverity::Warning>(standardOut, debugOut, coloured);
+    SetLoggingSinks<LogSeverity::Error>(standardOut, debugOut, coloured);
+    SetLoggingSinks<LogSeverity::Fatal>(standardOut, debugOut, coloured);
+}
+
+enum class BoostLogSeverityMapping
+{
+    trace,
+    debug,
+    info,
+    warning,
+    error,
+    fatal
+};
+
+constexpr LogSeverity ConvertLogSeverity(BoostLogSeverityMapping severity)
+{
+    return static_cast<LogSeverity>(severity);
+}
+
+
+#define ARMNN_LOG(severity) \
+    armnn::SimpleLogger<ConvertLogSeverity(armnn::BoostLogSeverityMapping::severity)>::Get().StartNewRecord()
+
+} //namespace armnn
index 26a27f410085a7d3c947eb0804a844078a9e3b37..3113d61f1219ba54550a0d639afc5973335ded03 100644 (file)
@@ -26,4 +26,13 @@ enum class LogSeverity
 ///     severity: All log messages that are at this severity level or higher will be printed, others will be ignored.
 void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity);
 
+
+#if defined(__clang__) &&((__clang_major__>=3)||(__clang_major__==3 && __clang_minor__ >= 5))
+#   define ARMNN_FALLTHROUGH [[clang::fallthrough]]
+#elif defined(__GNUC__) && (__GNUC__ >= 7)
+#   define ARMNN_FALLTHROUGH __attribute__((fallthrough))
+#else
+#   define ARMNN_FALLTHROUGH ((void)0)
+#endif
+
 } // namespace armnn
index 381d0406837c947e038ccbfc772a2a035e4e8b47..95f9b5dd2b7ddf3a3a994f9cac9f3d349c2a805e 100644 (file)
@@ -3,13 +3,13 @@
 // SPDX-License-Identifier: MIT
 //
 #include "armnn/Descriptors.hpp"
+#include "armnn/Logging.hpp"
 
 #include <algorithm>
 #include <array>
 #include <vector>
 
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 namespace armnn
@@ -160,13 +160,13 @@ Status OriginsDescriptor::SetViewOriginCoord(uint32_t view, uint32_t coord, uint
 {
     if (view >= m_NumViews)
     {
-        BOOST_LOG_TRIVIAL(error) << "OriginsDescriptor::SetViewOriginCoord: view argument:" << view <<
+        ARMNN_LOG(error) << "OriginsDescriptor::SetViewOriginCoord: view argument:" << view <<
             " is out of range";
         return Status::Failure;
     }
     if (coord >= m_NumDimensions)
     {
-        BOOST_LOG_TRIVIAL(error) << "OriginsDescriptor::SetViewOriginCoord: coord argument:" << coord <<
+        ARMNN_LOG(error) << "OriginsDescriptor::SetViewOriginCoord: coord argument:" << coord <<
             " is out of range";
         return Status::Failure;
     }
@@ -308,19 +308,19 @@ Status ViewsDescriptor::SetViewSize(uint32_t view, uint32_t coord, uint32_t valu
 {
     if (!m_ViewSizes)
     {
-        BOOST_LOG_TRIVIAL(error) << "ViewsDescriptor::SetViewSize: invalid view sizes";
+        ARMNN_LOG(error) << "ViewsDescriptor::SetViewSize: invalid view sizes";
         return Status::Failure;
     }
 
     if (view >= GetNumViews())
     {
-        BOOST_LOG_TRIVIAL(error) << "ViewsDescriptor::SetViewSize: view argument:" << view <<
+        ARMNN_LOG(error) << "ViewsDescriptor::SetViewSize: view argument:" << view <<
                                  " is out of range";
         return Status::Failure;
     }
     if (coord >= GetNumDimensions())
     {
-        BOOST_LOG_TRIVIAL(error) << "ViewsDescriptor::SetViewSize: coord argument:" << coord <<
+        ARMNN_LOG(error) << "ViewsDescriptor::SetViewSize: coord argument:" << coord <<
                                  " is out of range";
         return Status::Failure;
     }
index 4e02be3531eb131b927d59eff3bf327e0148e857..fe6a7c8afa4975b2f45ba0abd00a7845604efd99 100644 (file)
@@ -14,7 +14,6 @@
 #include <armnn/TypesUtils.hpp>
 
 #include <boost/polymorphic_cast.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
 
@@ -62,18 +61,18 @@ Status Graph::Print() const
 {
     if (m_Layers.empty())
     {
-        BOOST_LOG_TRIVIAL(info) << "\n Graph is empty.\n";
+        ARMNN_LOG(info) << "\n Graph is empty.\n";
         return Status::Success;
     }
-    BOOST_LOG_TRIVIAL(info) << "\n";
-    BOOST_LOG_TRIVIAL(info) << "Walking Pattern: \n";
+    ARMNN_LOG(info) << "\n";
+    ARMNN_LOG(info) << "Walking Pattern: \n";
 
     for (auto&& it : TopologicalSort())
     {
-        BOOST_LOG_TRIVIAL(info) << it->GetName() << ":" << GetLayerTypeAsCString(it->GetType())
+        ARMNN_LOG(info) << it->GetName() << ":" << GetLayerTypeAsCString(it->GetType())
                                 << ":" << it->GetBackendId().Get();
     }
-    BOOST_LOG_TRIVIAL(info) << "\n\n";
+    ARMNN_LOG(info) << "\n\n";
 
     return Status::Success;
 }
index 1efe7e412fc769dd388191c1325f366455598b12..8350ea83c13975b78a370bdade12dbaa15316bb7 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <boost/cast.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 
 #include <numeric>
 
index 16ec42308c3b98a7f25eb6651c85573fe9dcf814..86cd9ede23afd8d640f2605c46031ef6581f1fb3 100644 (file)
@@ -23,7 +23,6 @@
 #include <boost/polymorphic_cast.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 
 namespace armnn
 {
@@ -90,7 +89,7 @@ std::unique_ptr<LoadedNetwork> LoadedNetwork::MakeLoadedNetwork(std::unique_ptr<
     auto Fail = [&](const std::exception& error) -> std::unique_ptr<LoadedNetwork>
     {
         errorMessage = ToErrorMessage("An error occurred when preparing the network workloads: ", error);
-        BOOST_LOG_TRIVIAL(error) << errorMessage;
+        ARMNN_LOG(error) << errorMessage;
 
         return std::unique_ptr<LoadedNetwork>();
     };
@@ -418,7 +417,7 @@ Status LoadedNetwork::EnqueueWorkload(const InputTensors& inputTensors,
     // Walk graph to determine the order of execution.
     if (graph.GetNumLayers() < 2)
     {
-        BOOST_LOG_TRIVIAL(warning) << "IRuntime::EnqueueWorkload()::Less than two nodes in graph";
+        ARMNN_LOG(warning) << "IRuntime::EnqueueWorkload()::Less than two nodes in graph";
         return Status::Failure;
     }
 
@@ -679,7 +678,7 @@ bool LoadedNetwork::Execute(std::unique_ptr<TimelineUtilityMethods>& timelineUti
 
     auto Fail = [&](const std::exception& error)
     {
-        BOOST_LOG_TRIVIAL(error) << "An error occurred attempting to execute a workload: " << error.what();
+        ARMNN_LOG(error) << "An error occurred attempting to execute a workload: " << error.what();
         success = false;
     };
 
index 53e28c344ac86ca7c8b5079859ea022d2bcc9132..c764e2a059e8e0aade8d60ebccffd461ef9c31a2 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/converter_policies.hpp>
 #include <boost/cast.hpp>
 
@@ -76,7 +75,7 @@ void ReportError(const std::string& errorMessage,
 {
     std::stringstream fullErrorMessage;
     fullErrorMessage << "ERROR: " << errorMessage;
-    BOOST_LOG_TRIVIAL(warning) << fullErrorMessage.str();
+    ARMNN_LOG(warning) << fullErrorMessage.str();
     if (errorMessages)
     {
         errorMessages.value().push_back(fullErrorMessage.str());
@@ -88,7 +87,7 @@ void ReportWarning(const std::string& warningMessage,
 {
     std::stringstream fullWarningMessage;
     fullWarningMessage << "WARNING: " << warningMessage;
-    BOOST_LOG_TRIVIAL(warning) << fullWarningMessage.str();
+    ARMNN_LOG(warning) << fullWarningMessage.str();
     if (warningMessages)
     {
         warningMessages.value().push_back(fullWarningMessage.str());
@@ -120,7 +119,7 @@ bool CheckScaleSetOnQuantizedType(Layer* layer, Optional<std::vector<std::string
                 ss << "Quantization parameters for Softmax layer (Scale: " <<
                 info.GetQuantizationScale() << " and Offset: " << info.GetQuantizationOffset() <<
                 ") are incorrect and have been updated to Scale: 0.00390625 and Offset: 0";
-                BOOST_LOG_TRIVIAL(warning) << ss.str();
+                ARMNN_LOG(warning) << ss.str();
                 info.SetQuantizationScale((1.0f /256.0f));
                 info.SetQuantizationOffset(0);
                 outputSlot.SetTensorInfo(info);
index 4dd5a223209a740ee21662d217a52e90fef2c156..192817e69dc449d01381fe354f8465e9e3c65c7d 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <iostream>
 
-#include <boost/log/trivial.hpp>
 #include <boost/polymorphic_cast.hpp>
 
 using namespace armnn;
@@ -106,8 +105,8 @@ Status Runtime::UnloadNetwork(NetworkId networkId)
 
     if (!unloadOk)
     {
-        BOOST_LOG_TRIVIAL(warning) << "Runtime::UnloadNetwork(): failed to unload "
-                                      "network with ID:" << networkId << " because BeforeUnloadNetwork failed";
+        ARMNN_LOG(warning) << "Runtime::UnloadNetwork(): failed to unload "
+                              "network with ID:" << networkId << " because BeforeUnloadNetwork failed";
         return Status::Failure;
     }
 
@@ -116,7 +115,7 @@ Status Runtime::UnloadNetwork(NetworkId networkId)
 
         if (m_LoadedNetworks.erase(networkId) == 0)
         {
-            BOOST_LOG_TRIVIAL(warning) << "WARNING: Runtime::UnloadNetwork(): " << networkId << " not found!";
+            ARMNN_LOG(warning) << "WARNING: Runtime::UnloadNetwork(): " << networkId << " not found!";
             return Status::Failure;
         }
     }
@@ -126,7 +125,7 @@ Status Runtime::UnloadNetwork(NetworkId networkId)
         context.second->AfterUnloadNetwork(networkId);
     }
 
-    BOOST_LOG_TRIVIAL(debug) << "Runtime::UnloadNetwork(): Unloaded network with ID: " << networkId;
+    ARMNN_LOG(debug) << "Runtime::UnloadNetwork(): Unloaded network with ID: " << networkId;
     return Status::Success;
 }
 
@@ -146,7 +145,7 @@ Runtime::Runtime(const CreationOptions& options)
     : m_NetworkIdCounter(0)
     , m_DeviceSpec{BackendRegistryInstance().GetBackendIds()}
 {
-    BOOST_LOG_TRIVIAL(info) << "ArmNN v" << ARMNN_VERSION << "\n";
+    ARMNN_LOG(info) << "ArmNN v" << ARMNN_VERSION << "\n";
 
     // pass configuration info to the profiling service
     armnn::profiling::ProfilingService::Instance().ConfigureProfilingService(options.m_ProfilingOptions);
index dad9722aeb092e676f561a202f8cedfa06368294..171e02ad1328185335e2e95fe180734a89b7bfb6 100644 (file)
@@ -9,7 +9,6 @@
 #include "armnn/TypesUtils.hpp"
 
 #include <boost/assert.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 #include <sstream>
index b59999e848cdaabe2dd15ca160d35b0a445b5d6d..fbf11c95880bbf6a3be47774a60509b8b6e83e2a 100644 (file)
@@ -2,17 +2,15 @@
 // Copyright © 2017 Arm Ltd. All rights reserved.
 // SPDX-License-Identifier: MIT
 //
+#include "armnn/Logging.hpp"
 #include "armnn/Utils.hpp"
-#include "Logging.hpp"
-
-#include <boost/log/core.hpp>
 
 namespace armnn
 {
 void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
 {
-    using armnnUtils::ConfigureLogging;
-    ConfigureLogging(boost::log::core::get().get(), printToStandardOutput, printToDebugOutput, severity);
+    SetAllLoggingSinks(printToStandardOutput, printToDebugOutput, false);
+    SetLogFilter(severity);
 }
 
 // Defaults to logging completely disabled.
index e1618512eb5b8a57fdf661179f5137662efe6e53..8bbe3d9f412bc2b4f676b63e77663bb64c320988 100644 (file)
@@ -8,7 +8,6 @@
 #include <boost/test/unit_test.hpp>
 
 #include <boost/filesystem.hpp>
-#include <boost/log/core/core.hpp>
 #include <boost/optional.hpp>
 #include <boost/variant.hpp>
 #include <iostream>
index c08b7055060ca699bed3dac13f9cf87bfcce6b08..7d171a8d88a50a4fc7fdae27cad3b0e66d473e4d 100644 (file)
@@ -6,6 +6,9 @@
 #include <boost/test/unit_test.hpp>
 
 #include "UnitTests.hpp"
+#include <armnn/Logging.hpp>
+
+#include <boost/algorithm/string.hpp>
 
 struct ConfigureLoggingFixture
 {
@@ -57,4 +60,55 @@ private:
 
 BOOST_GLOBAL_FIXTURE(SetupDebugOutput);
 
-#endif // defined(_MSC_VER)
\ No newline at end of file
+#endif // defined(_MSC_VER)
+
+
+BOOST_AUTO_TEST_SUITE(LoggerSuite)
+
+BOOST_AUTO_TEST_CASE(LoggerTest)
+{
+    std::stringstream ss;
+
+    {
+        struct StreamRedirector
+        {
+        public:
+            StreamRedirector(std::ostream& stream, std::streambuf* newStreamBuffer)
+                : m_Stream(stream)
+                , m_BackupBuffer(m_Stream.rdbuf(newStreamBuffer))
+            {}
+            ~StreamRedirector() { m_Stream.rdbuf(m_BackupBuffer); }
+
+        private:
+            std::ostream& m_Stream;
+            std::streambuf* m_BackupBuffer;
+        };
+
+
+        StreamRedirector redirect(std::cout, ss.rdbuf());
+
+        using namespace armnn;
+        SetLogFilter(LogSeverity::Trace);
+        SetAllLoggingSinks(true, false, false);
+
+
+        ARMNN_LOG(trace) << "My trace message; " << -2;
+        ARMNN_LOG(debug) << "My debug message; " << -1;
+        ARMNN_LOG(info) << "My info message; " << 0;
+        ARMNN_LOG(warning) << "My warning message; "  << 1;
+        ARMNN_LOG(error) << "My error message; " << 2;
+        ARMNN_LOG(fatal) << "My fatal message; "  << 3;
+
+        SetLogFilter(LogSeverity::Fatal);
+
+    }
+
+    BOOST_CHECK(boost::contains(ss.str(), "Trace: My trace message; -2"));
+    BOOST_CHECK(boost::contains(ss.str(), "Debug: My debug message; -1"));
+    BOOST_CHECK(boost::contains(ss.str(), "Info: My info message; 0"));
+    BOOST_CHECK(boost::contains(ss.str(), "Warning: My warning message; 1"));
+    BOOST_CHECK(boost::contains(ss.str(), "Error: My error message; 2"));
+    BOOST_CHECK(boost::contains(ss.str(), "Fatal: My fatal message; 3"));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
index dc97f90ba94ffa14e76976a6d0cc82f16ad1a0d4..60d191f97d87c88d375f1b674f087cbbc63c576c 100644 (file)
@@ -4,7 +4,7 @@
 //
 #pragma once
 
-#include <Logging.hpp>
+#include <armnn/Logging.hpp>
 #include <armnn/Utils.hpp>
 #include <reference/RefWorkloadFactory.hpp>
 #include <backendsCommon/test/LayerTests.hpp>
@@ -16,7 +16,6 @@ inline void ConfigureLoggingTest()
 {
     // Configures logging for both the ARMNN library and this test program.
     armnn::ConfigureLogging(true, true, armnn::LogSeverity::Fatal);
-    armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, armnn::LogSeverity::Fatal);
 }
 
 // The following macros require the caller to have defined FactoryType, with one of the following using statements:
index cf2e140b680d9b05ac6655acec048731929c5f3d..ce5c5bd4f574cd70ae565c3a7f25b9c080bb21c1 100644 (file)
@@ -16,7 +16,6 @@
 #include <boost/numeric/conversion/cast.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 
 // Caffe
 #include "caffe/proto/caffe.pb.h"
index 04cbb5dba2138213ba7776d49c6befe8652de5b2..28e94a07c5a7a2d48877799158cce48b35d0d173 100644 (file)
@@ -20,7 +20,6 @@
 #include <armnnTfLiteParser/ITfLiteParser.hpp>
 #endif
 
-#include <Logging.hpp>
 #include <HeapProfiling.hpp>
 
 #include <boost/format.hpp>
@@ -52,7 +51,7 @@ armnn::TensorShape ParseTensorShape(std::istream& stream)
         }
         catch (const std::exception& e)
         {
-            BOOST_LOG_TRIVIAL(error) << "An error occurred when splitting tokens: " << e.what();
+            ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what();
             continue;
         }
         for (const std::string& token : tokens)
@@ -65,7 +64,7 @@ armnn::TensorShape ParseTensorShape(std::istream& stream)
                 }
                 catch (const std::exception&)
                 {
-                    BOOST_LOG_TRIVIAL(error) << "'" << token << "' is not a valid number. It has been ignored.";
+                    ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored.";
                 }
             }
         }
@@ -192,7 +191,7 @@ int ParseCommandLineArgs(int argc, const char* argv[],
     }
     else
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'";
+        ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'";
         return EXIT_FAILURE;
     }
 
@@ -364,12 +363,12 @@ int main(int argc, const char* argv[])
        && !defined(ARMNN_ONNX_PARSER) \
        && !defined(ARMNN_TF_PARSER)   \
        && !defined(ARMNN_TF_LITE_PARSER))
-    BOOST_LOG_TRIVIAL(fatal) << "Not built with any of the supported parsers, Caffe, Onnx, Tensorflow, or TfLite.";
+    ARMNN_LOG(fatal) << "Not built with any of the supported parsers, Caffe, Onnx, Tensorflow, or TfLite.";
     return EXIT_FAILURE;
 #endif
 
 #if !defined(ARMNN_SERIALIZER)
-    BOOST_LOG_TRIVIAL(fatal) << "Not built with Serializer support.";
+    ARMNN_LOG(fatal) << "Not built with Serializer support.";
     return EXIT_FAILURE;
 #endif
 
@@ -380,7 +379,6 @@ int main(int argc, const char* argv[])
 #endif
 
     armnn::ConfigureLogging(true, true, level);
-    armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level);
 
     std::string modelFormat;
     std::string modelPath;
@@ -414,7 +412,7 @@ int main(int argc, const char* argv[])
             }
             catch (const armnn::InvalidArgumentException& e)
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Cannot create tensor shape: " << e.what();
+                ARMNN_LOG(fatal) << "Cannot create tensor shape: " << e.what();
                 return EXIT_FAILURE;
             }
         }
@@ -427,11 +425,11 @@ int main(int argc, const char* argv[])
 #if defined(ARMNN_CAFFE_PARSER)
         if (!converter.CreateNetwork<armnnCaffeParser::ICaffeParser>())
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Failed to load model from file";
+            ARMNN_LOG(fatal) << "Failed to load model from file";
             return EXIT_FAILURE;
         }
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Not built with Caffe parser support.";
+        ARMNN_LOG(fatal) << "Not built with Caffe parser support.";
         return EXIT_FAILURE;
 #endif
     }
@@ -440,11 +438,11 @@ int main(int argc, const char* argv[])
 #if defined(ARMNN_ONNX_PARSER)
         if (!converter.CreateNetwork<armnnOnnxParser::IOnnxParser>())
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Failed to load model from file";
+            ARMNN_LOG(fatal) << "Failed to load model from file";
             return EXIT_FAILURE;
         }
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Not built with Onnx parser support.";
+        ARMNN_LOG(fatal) << "Not built with Onnx parser support.";
         return EXIT_FAILURE;
 #endif
     }
@@ -453,11 +451,11 @@ int main(int argc, const char* argv[])
 #if defined(ARMNN_TF_PARSER)
         if (!converter.CreateNetwork<armnnTfParser::ITfParser>())
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Failed to load model from file";
+            ARMNN_LOG(fatal) << "Failed to load model from file";
             return EXIT_FAILURE;
         }
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Not built with Tensorflow parser support.";
+        ARMNN_LOG(fatal) << "Not built with Tensorflow parser support.";
         return EXIT_FAILURE;
 #endif
     }
@@ -466,30 +464,30 @@ int main(int argc, const char* argv[])
 #if defined(ARMNN_TF_LITE_PARSER)
         if (!isModelBinary)
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'. Only 'binary' format supported \
+            ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Only 'binary' format supported \
               for tflite files";
             return EXIT_FAILURE;
         }
 
         if (!converter.CreateNetwork<armnnTfLiteParser::ITfLiteParser>())
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Failed to load model from file";
+            ARMNN_LOG(fatal) << "Failed to load model from file";
             return EXIT_FAILURE;
         }
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Not built with TfLite parser support.";
+        ARMNN_LOG(fatal) << "Not built with TfLite parser support.";
         return EXIT_FAILURE;
 #endif
     }
     else
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'";
+        ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'";
         return EXIT_FAILURE;
     }
 
     if (!converter.Serialize())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to serialize model";
+        ARMNN_LOG(fatal) << "Failed to serialize model";
         return EXIT_FAILURE;
     }
 
index 3e6d5aa298e20cfdc0b10b272d9e06c1e4f8fb40..e01ed477404a5f8a50ea846d819d04148b08a6b9 100644 (file)
@@ -18,7 +18,6 @@
 #include <boost/core/ignore_unused.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/format.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 #include <boost/polymorphic_cast.hpp>
index 6122f5e967b82758775791d44ae9d82a40123770..f06e24422397fed25032bcaeb89bc07de75dda9b 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <armnn/ArmNN.hpp>
 #include <armnn/Exceptions.hpp>
+#include <armnn/Logging.hpp>
 #include <armnn/TypesUtils.hpp>
 #include <boost/filesystem.hpp>
 
@@ -24,8 +25,6 @@
 #include <boost/core/ignore_unused.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
-#include <boost/format.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 #include <fstream>
@@ -607,7 +606,7 @@ INetworkPtr TfLiteParser::CreateNetworkFromModel()
                 errorString << "Failed to parse operator #" << operatorIndex
                             << " within subgraph #" << subgraphIndex
                             << " error: " << e.what();
-                BOOST_LOG_TRIVIAL(error) << errorString.str();
+                ARMNN_LOG(error) << errorString.str();
 
                 errors << errorString.str() << "\n";
             }
diff --git a/src/armnnUtils/Logging.cpp b/src/armnnUtils/Logging.cpp
deleted file mode 100644 (file)
index 10f32dc..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "Logging.hpp"
-
-#include <string>
-#include <iostream>
-
-#if defined(_MSC_VER)
-#include <Windows.h>
-#endif
-
-#if defined(__ANDROID__)
-#include <android/log.h>
-#endif
-
-#include <boost/make_shared.hpp>
-#include <boost/log/core.hpp>
-#include <boost/log/sinks.hpp>
-#include <boost/log/sinks/debug_output_backend.hpp>
-#include <boost/log/sinks/basic_sink_backend.hpp>
-#include <boost/log/sinks/text_ostream_backend.hpp>
-#include <boost/log/utility/setup/console.hpp>
-
-namespace armnnUtils
-{
-
-struct DebugOutputSink : boost::log::sinks::basic_formatted_sink_backend<char, boost::log::sinks::concurrent_feeding>
-{
-    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<char> backend_t;
-        boost::shared_ptr<backend_t>                                backend = boost::make_shared<backend_t>();
-
-        boost::shared_ptr<std::basic_ostream<char>> stream(&std::cout, boost::null_deleter());
-        backend->add_stream(stream);
-
-        typedef boost::log::sinks::synchronous_sink<backend_t> sink_t;
-        boost::shared_ptr<sink_t>                              standardOutputSink = boost::make_shared<sink_t>(backend);
-
-        core->add_sink(standardOutputSink);
-    }
-    if (printToDebugOutput)
-    {
-        typedef boost::log::sinks::synchronous_sink<DebugOutputSink> sink_t;
-        boost::shared_ptr<sink_t>                                    debugOutputSink(new sink_t());
-        core->add_sink(debugOutputSink);
-    }
-}
-
-}
diff --git a/src/armnnUtils/Logging.hpp b/src/armnnUtils/Logging.hpp
deleted file mode 100644 (file)
index db60d38..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-
-#include "armnn/Utils.hpp"
-
-#include <boost/log/trivial.hpp>
-
-namespace armnnUtils
-{
-
-// Configures logging for the given Boost Log Core object.
-void ConfigureLogging(boost::log::core* core,
-                      bool              printToStandardOutput,
-                      bool              printToDebugOutput,
-                      armnn::LogSeverity severity);
-
-}
\ No newline at end of file
index 81942dc2beb64cc677c8e87b19b42f43d1630a72..818cb17a6533d95b03461a80ae3f92c969879c46 100644 (file)
@@ -4,8 +4,10 @@
 //
 
 #include "ModelAccuracyChecker.hpp"
+
+#include <armnn/Logging.hpp>
+
 #include <boost/filesystem.hpp>
-#include <boost/log/trivial.hpp>
 #include <map>
 #include <vector>
 
@@ -22,8 +24,8 @@ float ModelAccuracyChecker::GetAccuracy(unsigned int k)
 {
     if (k > 10)
     {
-        BOOST_LOG_TRIVIAL(warning) << "Accuracy Tool only supports a maximum of Top 10 Accuracy. "
-                                      "Printing Top 10 Accuracy result!";
+        ARMNN_LOG(warning) << "Accuracy Tool only supports a maximum of Top 10 Accuracy. "
+                              "Printing Top 10 Accuracy result!";
         k = 10;
     }
     unsigned int total = 0;
index da7c3244f1389ad0f6ce4e449f5962e4b6e4f956..b31ce60564db29c8b5caa1fe8f731b428d66de2c 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
-#include <boost/log/trivial.hpp>
 
 #include <regex>
 
@@ -84,8 +83,8 @@ std::vector<std::string> DynamicBackendUtils::GetBackendPaths(const std::string&
     {
         if (!IsPathValid(overrideBackendPath))
         {
-            BOOST_LOG_TRIVIAL(warning) << "WARNING: The given override path for dynamic backends \""
-                                       << overrideBackendPath << "\" is not valid";
+            ARMNN_LOG(warning) << "WARNING: The given override path for dynamic backends \""
+                               << overrideBackendPath << "\" is not valid";
 
             return {};
         }
@@ -146,7 +145,7 @@ bool DynamicBackendUtils::IsPathValid(const std::string& path)
 {
     if (path.empty())
     {
-        BOOST_LOG_TRIVIAL(warning) << "WARNING: The given backend path is empty";
+        ARMNN_LOG(warning) << "WARNING: The given backend path is empty";
         return false;
     }
 
@@ -154,19 +153,19 @@ bool DynamicBackendUtils::IsPathValid(const std::string& path)
 
     if (!boost::filesystem::exists(boostPath))
     {
-        BOOST_LOG_TRIVIAL(warning) << "WARNING: The given backend path \"" << path << "\" does not exist";
+        ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" does not exist";
         return false;
     }
 
     if (!boost::filesystem::is_directory(boostPath))
     {
-        BOOST_LOG_TRIVIAL(warning) << "WARNING: The given backend path \"" << path << "\" is not a directory";
+        ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" is not a directory";
         return false;
     }
 
     if (!boostPath.is_absolute())
     {
-        BOOST_LOG_TRIVIAL(warning) << "WARNING: The given backend path \"" << path << "\" is not absolute";
+        ARMNN_LOG(warning) << "WARNING: The given backend path \"" << path << "\" is not absolute";
         return false;
     }
 
@@ -214,7 +213,7 @@ std::vector<std::string> DynamicBackendUtils::GetSharedObjects(const std::vector
             }
             catch (const filesystem_error& e)
             {
-                BOOST_LOG_TRIVIAL(warning) << "GetSharedObjects warning: " << e.what();
+                ARMNN_LOG(warning) << "GetSharedObjects warning: " << e.what();
             }
             if (canonicalPath.empty())
             {
@@ -235,7 +234,7 @@ std::vector<std::string> DynamicBackendUtils::GetSharedObjects(const std::vector
             }
             catch (const std::exception& e)
             {
-                BOOST_LOG_TRIVIAL(warning) << "GetSharedObjects warning: " << e.what();
+                ARMNN_LOG(warning) << "GetSharedObjects warning: " << e.what();
             }
             if (!filenameMatch)
             {
@@ -274,13 +273,13 @@ std::vector<DynamicBackendPtr> DynamicBackendUtils::CreateDynamicBackends(const
         }
         catch (const RuntimeException& e)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot create a handle to the shared object file \""
-                                       << sharedObject << "\": " << e.what();
+            ARMNN_LOG(warning) << "Cannot create a handle to the shared object file \""
+                               << sharedObject << "\": " << e.what();
             continue;
         }
         if (!sharedObjectHandle)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Invalid handle to the shared object file \"" << sharedObject << "\"";
+            ARMNN_LOG(warning) << "Invalid handle to the shared object file \"" << sharedObject << "\"";
 
             continue;
         }
@@ -293,14 +292,14 @@ std::vector<DynamicBackendPtr> DynamicBackendUtils::CreateDynamicBackends(const
         }
         catch (const Exception& e)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot create a valid dynamic backend from the shared object file \""
-                                       << sharedObject << "\": " << e.what();
+            ARMNN_LOG(warning) << "Cannot create a valid dynamic backend from the shared object file \""
+                               << sharedObject << "\": " << e.what();
             continue;
         }
         if (!dynamicBackend)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Invalid dynamic backend object for the shared object file \""
-                                       << sharedObject << "\"";
+            ARMNN_LOG(warning) << "Invalid dynamic backend object for the shared object file \""
+                               << sharedObject << "\"";
             continue;
         }
 
@@ -337,14 +336,14 @@ BackendIdSet DynamicBackendUtils::RegisterDynamicBackendsImpl(BackendRegistry& b
         }
         catch (const RuntimeException& e)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot register dynamic backend, "
-                                       << "an error has occurred when getting the backend id: " << e.what();
+            ARMNN_LOG(warning) << "Cannot register dynamic backend, "
+                               << "an error has occurred when getting the backend id: " << e.what();
             continue;
         }
         if (dynamicBackendId.IsEmpty() ||
             dynamicBackendId.IsUndefined())
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot register dynamic backend, invalid backend id: " << dynamicBackendId;
+            ARMNN_LOG(warning) << "Cannot register dynamic backend, invalid backend id: " << dynamicBackendId;
             continue;
         }
 
@@ -352,8 +351,8 @@ BackendIdSet DynamicBackendUtils::RegisterDynamicBackendsImpl(BackendRegistry& b
         bool backendAlreadyRegistered = backendRegistry.IsBackendRegistered(dynamicBackendId);
         if (backendAlreadyRegistered)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot register dynamic backend \"" << dynamicBackendId
-                                       << "\": backend already registered";
+            ARMNN_LOG(warning) << "Cannot register dynamic backend \"" << dynamicBackendId
+                               << "\": backend already registered";
             continue;
         }
 
@@ -365,15 +364,15 @@ BackendIdSet DynamicBackendUtils::RegisterDynamicBackendsImpl(BackendRegistry& b
         }
         catch (const RuntimeException& e)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot register dynamic backend \"" << dynamicBackendId
-                                       << "\": an error has occurred when getting the backend factory function: "
-                                       << e.what();
+            ARMNN_LOG(warning) << "Cannot register dynamic backend \"" << dynamicBackendId
+                               << "\": an error has occurred when getting the backend factory function: "
+                               << e.what();
             continue;
         }
         if (dynamicBackendFactoryFunction == nullptr)
         {
-            BOOST_LOG_TRIVIAL(warning) << "Cannot register dynamic backend \"" << dynamicBackendId
-                                       << "\": invalid backend factory function";
+            ARMNN_LOG(warning) << "Cannot register dynamic backend \"" << dynamicBackendId
+                               << "\": invalid backend factory function";
             continue;
         }
 
@@ -384,8 +383,8 @@ BackendIdSet DynamicBackendUtils::RegisterDynamicBackendsImpl(BackendRegistry& b
         }
         catch (const InvalidArgumentException& e)
         {
-            BOOST_LOG_TRIVIAL(warning) << "An error has occurred when registering the dynamic backend \""
-                                       << dynamicBackendId << "\": " << e.what();
+            ARMNN_LOG(warning) << "An error has occurred when registering the dynamic backend \""
+                               << dynamicBackendId << "\": " << e.what();
             continue;
         }
 
index e3a1b276eae6a29179ee0f83c13f154425fc96d6..e3655b08faeaf236dec033adc60b11919cb92d6c 100644 (file)
@@ -11,7 +11,6 @@
 #include <backendsCommon/WorkloadFactory.hpp>
 
 #include <boost/assert.hpp>
-#include <boost/log/trivial.hpp>
 
 namespace armnn
 {
index 48682b90dd2eaa9ddfbe4a8c19ed1e266e2e2974..a82391cce541939410ec76f2fc2d658902289f06 100644 (file)
@@ -4,14 +4,15 @@
 //
 
 #include "ClBackendContext.hpp"
+
+#include <armnn/Logging.hpp>
+
 #include "ClContextControl.hpp"
 
 #include <arm_compute/core/CL/OpenCL.h>
 #include <arm_compute/core/CL/CLKernelLibrary.h>
 #include <arm_compute/runtime/CL/CLScheduler.h>
 
-#include <boost/log/trivial.hpp>
-
 namespace armnn
 {
 
@@ -34,8 +35,8 @@ struct ClBackendContext::ClContextControlWrapper
             }
             catch (const cl::Error&)
             {
-                BOOST_LOG_TRIVIAL(warning) << "WARNING: Runtime::UnloadNetwork(): an error occurred while waiting for "
-                                              "the queued CL requests to finish";
+                ARMNN_LOG(warning) << "Runtime::UnloadNetwork(): an error occurred while waiting for "
+                                      "the queued CL requests to finish";
                 return false;
             }
         }
index 7013b8a4f8839a4a1645fdb8721d393a5daf8fdf..cf5ae64c789c51cf23e53bb5bac03d6b3bb7f329 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/polymorphic_cast.hpp>
 #include <boost/core/ignore_unused.hpp>
 
index 804580575edf468fb1972aa4a83d561e06ec6b36..531f3710eaf62b50b4a0d664fc1d5c6c9fe8e626 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <boost/polymorphic_cast.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 
 namespace armnn
 {
index 7fd93435e73affc68a6d6ff8e19de272532b42dc..8d044eecb7c2dffe2901a113b5aa26a13d46d5d6 100644 (file)
@@ -12,7 +12,6 @@
 #include "workloads/RefWorkloads.hpp"
 #include "RefTensorHandle.hpp"
 
-#include <boost/log/trivial.hpp>
 
 namespace armnn
 {
index 2b0c84e226a7f0368363884ba5c926539d5b4c77..814a0ddd13400d189f51fb06424a503852a7a6ba 100644 (file)
@@ -5,8 +5,6 @@
 
 #include "Activation.hpp"
 
-#include <boost/log/trivial.hpp>
-
 #include <cmath>
 
 namespace armnn
index 0427baf475c721dda4dbb270317b278c6c1b93cd..adf452dde19dbb6da5e4609acf92363cfb53231b 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <Profiling.hpp>
 
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 using namespace armnn;
@@ -196,13 +195,13 @@ void RefNormalizationWorkload::Execute() const
         }
         else
         {
-            BOOST_LOG_TRIVIAL(warning) << "Illegal NORMALIZATION mode in normalization_f32";
+            ARMNN_LOG(warning) << "Illegal NORMALIZATION mode in normalization_f32";
             return;
         }
     }
     else
     {
-        BOOST_LOG_TRIVIAL(warning) << "Lcr method (Jarret 2009: Local Contrast Normalization) not supported yet.";
+        ARMNN_LOG(warning) << "Lcr method (Jarret 2009: Local Contrast Normalization) not supported yet.";
         return;
     }
 }
index d9722b31836816f5efae6cbc929ed2c346c4639d..bb60ac18f063028c8f42e51546e84db2b24b2fc3 100644 (file)
@@ -6,7 +6,7 @@
 #include "CommandHandler.hpp"
 #include "ProfilingService.hpp"
 
-#include <boost/log/trivial.hpp>
+#include <armnn/Logging.hpp>
 
 namespace armnn
 {
@@ -75,7 +75,7 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
         catch (const Exception& e)
         {
             // Log the error and continue
-            BOOST_LOG_TRIVIAL(warning) << "An error has occurred when handling a command: " << e.what() << std::endl;
+            ARMNN_LOG(warning) << "An error has occurred when handling a command: " << e.what();
             // Did we get here because the socket failed?
             if ( !profilingConnection.IsOpen() )
             {
index 12e58f2800daf10761d5853527850a8c9a4b3990..f3bb5e9202e7313befc1106d2692d2a25d95fb6c 100644 (file)
@@ -5,7 +5,8 @@
 
 #include "PeriodicCounterCapture.hpp"
 
-#include <boost/log/trivial.hpp>
+#include <armnn/Logging.hpp>
+
 #include <iostream>
 
 namespace armnn
@@ -85,8 +86,8 @@ void PeriodicCounterCapture::Capture(const IReadCounterValues& readCounterValues
             catch (const Exception& e)
             {
                 // Report the error and continue
-                BOOST_LOG_TRIVIAL(warning) << "An error has occurred when getting a counter value: "
-                                           << e.what() << std::endl;
+                ARMNN_LOG(warning) << "An error has occurred when getting a counter value: "
+                                           << e.what();
                 continue;
             }
             values.emplace_back(std::make_pair(requestedId, counterValue));
index ddd4d80b06347591bad4025a9cd5f465ab3f9359..409e71dfa05d524446f4ae5425b897b26b7f7f6e 100644 (file)
@@ -5,7 +5,8 @@
 
 #include "ProfilingService.hpp"
 
-#include <boost/log/trivial.hpp>
+#include <armnn/Logging.hpp>
+
 #include <boost/format.hpp>
 
 namespace armnn
@@ -118,8 +119,8 @@ void ProfilingService::Update()
         }
         catch (const Exception& e)
         {
-            BOOST_LOG_TRIVIAL(warning) << "An error has occurred when creating the profiling connection: "
-                                       << e.what() << std::endl;
+            ARMNN_LOG(warning) << "An error has occurred when creating the profiling connection: "
+                                       << e.what();
         }
 
         // Move to the next state
index 65c182b6221af3cd7eb14a51d8a4abc0b20b1659..cfac691cff17efa60425eedb8a29a3d468a6aff7 100644 (file)
@@ -7,9 +7,10 @@
 
 #include "SendCounterPacketTests.hpp"
 
+#include <armnn/Logging.hpp>
+
 #include <CommandHandlerFunctor.hpp>
 #include <IProfilingConnection.hpp>
-#include <Logging.hpp>
 #include <ProfilingService.hpp>
 
 #include <boost/polymorphic_cast.hpp>
index 7dd6e6955c9804f5311549d2a38774062906337a..6adc75dc64d51d827d82d26c73499fdf2e97c55e 100644 (file)
@@ -6,7 +6,6 @@
 #include "CaffePreprocessor.hpp"
 
 #include <boost/numeric/conversion/cast.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
 
index 6ba5085b361871c37ec77240a3f11bc4f4aa4755..b0a90592d29befb35360e3b10454d7a2f75e99a6 100644 (file)
@@ -4,8 +4,9 @@
 //
 #include "Cifar10Database.hpp"
 
+#include <armnn/Logging.hpp>
+
 #include <boost/numeric/conversion/cast.hpp>
-#include <boost/log/trivial.hpp>
 #include <fstream>
 #include <vector>
 
@@ -25,7 +26,7 @@ std::unique_ptr<Cifar10Database::TTestCaseData> Cifar10Database::GetTestCaseData
     std::ifstream fileStream(fullpath, std::ios::binary);
     if (!fileStream.is_open())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load " << fullpath;
+        ARMNN_LOG(fatal) << "Failed to load " << fullpath;
         return nullptr;
     }
 
@@ -34,7 +35,7 @@ std::unique_ptr<Cifar10Database::TTestCaseData> Cifar10Database::GetTestCaseData
 
     if (!fileStream.good())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << fullpath;
+        ARMNN_LOG(fatal) << "Failed to read " << fullpath;
         return nullptr;
     }
 
index 182f373fc217f11c0e047271a916c53d8ff44dd0..a690e3fecec614de4835bcdae5c2945572084c0b 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <armnn/TypesUtils.hpp>
 
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 #include <array>
@@ -39,7 +38,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme
         }
         catch (const std::exception& e)
         {
-            BOOST_LOG_TRIVIAL(error) << "An error occurred when splitting tokens: " << e.what();
+            ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what();
             continue;
         }
         for (const std::string& token : tokens)
@@ -52,7 +51,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme
                 }
                 catch (const std::exception&)
                 {
-                    BOOST_LOG_TRIVIAL(error) << "'" << token << "' is not a valid number. It has been ignored.";
+                    ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored.";
                 }
             }
         }
@@ -163,7 +162,7 @@ std::unique_ptr<DeepSpeechV1TestCaseData> DeepSpeechV1Database::GetTestCaseData(
     }
     catch (const InferenceTestImageException& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
+        ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
         return nullptr;
     }
 
@@ -188,7 +187,7 @@ std::unique_ptr<DeepSpeechV1TestCaseData> DeepSpeechV1Database::GetTestCaseData(
     }
     catch (const InferenceTestImageException& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
+        ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
         return nullptr;
     }
 
index 3195d2bb1421f5de668e403005a384a01f6d53c7..c46fa5799f6018c842f10ab3fca95ae171d8c8ce 100644 (file)
@@ -8,7 +8,6 @@
 #include "DeepSpeechV1Database.hpp"
 
 #include <boost/assert.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 #include <boost/test/tools/floating_point_comparison.hpp>
 
@@ -51,7 +50,7 @@ public:
         {
             if(!m_FloatComparer(output1[j], m_ExpectedOutputs.m_InputSeq[j]))
             {
-                BOOST_LOG_TRIVIAL(error) << "InputSeq for Lstm " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "InputSeq for Lstm " << this->GetTestCaseId() <<
                                          " is incorrect at" << j;
                 return TestCaseResult::Failed;
             }
@@ -61,7 +60,7 @@ public:
         {
             if(!m_FloatComparer(output2[j], m_ExpectedOutputs.m_StateH[j]))
             {
-                BOOST_LOG_TRIVIAL(error) << "StateH for Lstm " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "StateH for Lstm " << this->GetTestCaseId() <<
                                          " is incorrect";
                 return TestCaseResult::Failed;
             }
@@ -71,7 +70,7 @@ public:
         {
             if(!m_FloatComparer(output3[j], m_ExpectedOutputs.m_StateC[j]))
             {
-                BOOST_LOG_TRIVIAL(error) << "StateC for Lstm " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "StateC for Lstm " << this->GetTestCaseId() <<
                                          " is incorrect";
                 return TestCaseResult::Failed;
             }
index 16e1fd3477aa97bb85535114397d65d1e15251f5..55864c8e023d4b00f969669d2da24cbebe3de58e 100644 (file)
@@ -15,7 +15,6 @@ int main(int argc, const char* argv[])
     armnn::LogSeverity level = armnn::LogSeverity::Debug;
 #endif
     armnn::ConfigureLogging(true, true, level);
-    armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level);
 
     std::string testCasesFile;
 
@@ -120,7 +119,7 @@ int main(int argc, const char* argv[])
         // and that desc.add_options() can throw boost::io::too_few_args.
         // They really won't in any of these cases.
         BOOST_ASSERT_MSG(false, "Caught unexpected exception");
-        BOOST_LOG_TRIVIAL(fatal) << "Fatal internal error: " << e.what();
+        ARMNN_LOG(fatal) << "Fatal internal error: " << e.what();
         return EXIT_FAILURE;
     }
 
@@ -166,7 +165,7 @@ int main(int argc, const char* argv[])
         // Check that the file exists.
         if (!boost::filesystem::exists(testCasesFile))
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Given file \"" << testCasesFile << "\" does not exist";
+            ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" does not exist";
             return EXIT_FAILURE;
         }
 
@@ -177,7 +176,7 @@ int main(int argc, const char* argv[])
         // Check that there is at least one test case to run
         if (testCases.empty())
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Given file \"" << testCasesFile << "\" has no test cases";
+            ARMNN_LOG(fatal) << "Given file \"" << testCasesFile << "\" has no test cases";
             return EXIT_FAILURE;
         }
 
index 5bd8532cbdfa8db579de347348a10f0ec2a77f37..4e8fe78ad89ce8ab2fe220d884caafa90d02084c 100644 (file)
@@ -5,12 +5,12 @@
 
 #include "ImageTensorGenerator.hpp"
 #include "../InferenceTestImage.hpp"
+#include <armnn/Logging.hpp>
 #include <armnn/TypesUtils.hpp>
 
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/path.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/program_options.hpp>
 #include <boost/variant.hpp>
 
@@ -285,7 +285,7 @@ int main(int argc, char* argv[])
     }
     catch (const InferenceTestImageException& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load image file " << imagePath << " with error: " << e.what();
+        ARMNN_LOG(fatal) << "Failed to load image file " << imagePath << " with error: " << e.what();
         return -1;
     }
 
@@ -297,7 +297,7 @@ int main(int argc, char* argv[])
                              imageDataContainers[0]);
         if (!imageTensorFile)
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Failed to write to output file" << outputPath;
+            ARMNN_LOG(fatal) << "Failed to write to output file" << outputPath;
             imageTensorFile.close();
             return -1;
         }
@@ -305,7 +305,7 @@ int main(int argc, char* argv[])
     }
     else
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to open output file" << outputPath;
+        ARMNN_LOG(fatal) << "Failed to open output file" << outputPath;
         return -1;
     }
 
index 6ec63ba223c7b32356e91cad9dfbe724f1bebb61..50b160774398a8e2484887755cba749184654935 100644 (file)
@@ -24,7 +24,6 @@
 #include <boost/algorithm/string/join.hpp>
 #include <boost/exception/exception.hpp>
 #include <boost/exception/diagnostic_information.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/format.hpp>
 #include <boost/program_options.hpp>
 #include <boost/filesystem.hpp>
index cf97459ddc99a58c2e7b354074c19e46cdc3d51b..c6e5011ae435d4d4e0818d7096012c447ecaa4c1 100644 (file)
@@ -7,7 +7,6 @@
 #include "../src/armnn/Profiling.hpp"
 #include <boost/algorithm/string.hpp>
 #include <boost/numeric/conversion/cast.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
@@ -125,7 +124,7 @@ bool InferenceTest(const InferenceTestOptions& params,
 #if !defined (NDEBUG)
     if (params.m_IterationCount > 0) // If just running a few select images then don't bother to warn.
     {
-        BOOST_LOG_TRIVIAL(warning) << "Performance test running in DEBUG build - results may be inaccurate.";
+        ARMNN_LOG(warning) << "Performance test running in DEBUG build - results may be inaccurate.";
     }
 #endif
 
@@ -141,7 +140,7 @@ bool InferenceTest(const InferenceTestOptions& params,
         inferenceTimesFile.open(params.m_InferenceTimesFile.c_str(), ios_base::trunc | ios_base::out);
         if (!inferenceTimesFile.good())
         {
-            BOOST_LOG_TRIVIAL(error) << "Failed to open inference times file for writing: "
+            ARMNN_LOG(error) << "Failed to open inference times file for writing: "
                 << params.m_InferenceTimesFile;
             return false;
         }
@@ -158,7 +157,7 @@ bool InferenceTest(const InferenceTestOptions& params,
     std::unique_ptr<IInferenceTestCase> warmupTestCase = testCaseProvider.GetTestCase(0);
     if (warmupTestCase == nullptr)
     {
-        BOOST_LOG_TRIVIAL(error) << "Failed to load test case";
+        ARMNN_LOG(error) << "Failed to load test case";
         return false;
     }
 
@@ -168,7 +167,7 @@ bool InferenceTest(const InferenceTestOptions& params,
     }
     catch (const TestFrameworkException& testError)
     {
-        BOOST_LOG_TRIVIAL(error) << testError.what();
+        ARMNN_LOG(error) << testError.what();
         return false;
     }
 
@@ -182,7 +181,7 @@ bool InferenceTest(const InferenceTestOptions& params,
 
         if (testCase == nullptr)
         {
-            BOOST_LOG_TRIVIAL(error) << "Failed to load test case";
+            ARMNN_LOG(error) << "Failed to load test case";
             return false;
         }
 
@@ -214,7 +213,7 @@ bool InferenceTest(const InferenceTestOptions& params,
         }
         catch (const TestFrameworkException& testError)
         {
-            BOOST_LOG_TRIVIAL(error) << testError.what();
+            ARMNN_LOG(error) << testError.what();
             result = TestCaseResult::Abort;
         }
 
@@ -236,9 +235,9 @@ bool InferenceTest(const InferenceTestOptions& params,
 
     const double averageTimePerTestCaseMs = totalTime / nbProcessed * 1000.0f;
 
-    BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(3) <<
+    ARMNN_LOG(info) << std::fixed << std::setprecision(3) <<
         "Total time for " << nbProcessed << " test cases: " << totalTime << " seconds";
-    BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(3) <<
+    ARMNN_LOG(info) << std::fixed << std::setprecision(3) <<
         "Average time per test case: " << averageTimePerTestCaseMs << " ms";
 
     // if profiling is enabled print out the results
@@ -249,7 +248,7 @@ bool InferenceTest(const InferenceTestOptions& params,
 
     if (!success)
     {
-        BOOST_LOG_TRIVIAL(error) << "One or more test cases failed";
+        ARMNN_LOG(error) << "One or more test cases failed";
         return false;
     }
 
index f2b8c634cc324f34bd695485f6cc6523e8fac2ea..7b7dcecea0871e6921e48ca8c7058d300dccd76c 100644 (file)
@@ -5,12 +5,11 @@
 #pragma once
 
 #include <armnn/ArmNN.hpp>
+#include <armnn/Logging.hpp>
 #include <armnn/TypesUtils.hpp>
 #include "InferenceModel.hpp"
 
-#include <Logging.hpp>
 
-#include <boost/log/core/core.hpp>
 #include <boost/program_options.hpp>
 
 
index c91193f1877355f8bbd0148fb1c27925f391e5b1..fd888e2137dd3295173a853f05851e972ca5bdc8 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <boost/algorithm/string.hpp>
 #include <boost/numeric/conversion/cast.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
@@ -121,11 +120,11 @@ TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(cons
     ClassifierResultProcessor resultProcessor(m_QuantizationParams.first, m_QuantizationParams.second);
     boost::apply_visitor(resultProcessor, output);
 
-    BOOST_LOG_TRIVIAL(info) << "= Prediction values for test #" << testCaseId;
+    ARMNN_LOG(info) << "= Prediction values for test #" << testCaseId;
     auto it = resultProcessor.GetResultMap().rbegin();
     for (int i=0; i<5 && it != resultProcessor.GetResultMap().rend(); ++i)
     {
-        BOOST_LOG_TRIVIAL(info) << "Top(" << (i+1) << ") prediction is " << it->second <<
+        ARMNN_LOG(info) << "Top(" << (i+1) << ") prediction is " << it->second <<
           " with value: " << (it->first);
         ++it;
     }
@@ -141,7 +140,7 @@ TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(cons
     // If we're just running the defaultTestCaseIds, each one must be classified correctly.
     if (params.m_IterationCount == 0 && prediction != m_Label)
     {
-        BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" <<
+        ARMNN_LOG(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" <<
             " is incorrect (should be " << m_Label << ")";
         return TestCaseResult::Failed;
     }
@@ -149,7 +148,7 @@ TestCaseResult ClassifierTestCase<TTestCaseDatabase, TModel>::ProcessResult(cons
     // If a validation file was provided as input, it checks that the prediction matches.
     if (!m_ValidationPredictions.empty() && prediction != m_ValidationPredictions[testCaseId])
     {
-        BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" <<
+        ARMNN_LOG(error) << "Prediction for test case " << testCaseId << " (" << prediction << ")" <<
             " doesn't match the prediction in the validation file (" << m_ValidationPredictions[testCaseId] << ")";
         return TestCaseResult::Failed;
     }
@@ -250,7 +249,7 @@ bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::OnInferenceTestFinis
 {
     const double accuracy = boost::numeric_cast<double>(m_NumCorrectInferences) /
         boost::numeric_cast<double>(m_NumInferences);
-    BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(3) << "Overall accuracy: " << accuracy;
+    ARMNN_LOG(info) << std::fixed << std::setprecision(3) << "Overall accuracy: " << accuracy;
 
     // If a validation file was requested as output, the predictions are saved to it.
     if (!m_ValidationFileOut.empty())
@@ -265,7 +264,7 @@ bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::OnInferenceTestFinis
         }
         else
         {
-            BOOST_LOG_TRIVIAL(error) << "Failed to open output validation file: " << m_ValidationFileOut;
+            ARMNN_LOG(error) << "Failed to open output validation file: " << m_ValidationFileOut;
             return false;
         }
     }
@@ -310,7 +309,6 @@ int InferenceTestMain(int argc,
     armnn::LogSeverity level = armnn::LogSeverity::Debug;
 #endif
     armnn::ConfigureLogging(true, true, level);
-    armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level);
 
     try
     {
@@ -331,7 +329,7 @@ int InferenceTestMain(int argc,
     }
     catch (armnn::Exception const& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Armnn Error: " << e.what();
+        ARMNN_LOG(fatal) << "Armnn Error: " << e.what();
         return 1;
     }
 }
index d2fe1649f3f4aee564ccc6254a3e7358e12ef0d2..bd5029f841fa61c0990e4c321973390f6aea4e7d 100644 (file)
@@ -4,8 +4,9 @@
 //
 #include "MnistDatabase.hpp"
 
+#include <armnn/Logging.hpp>
+
 #include <boost/numeric/conversion/cast.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/assert.hpp>
 #include <fstream>
 #include <vector>
@@ -36,12 +37,12 @@ std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(uns
 
     if (!imageStream.is_open())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load " << imagePath;
+        ARMNN_LOG(fatal) << "Failed to load " << imagePath;
         return nullptr;
     }
     if (!labelStream.is_open())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load " << imagePath;
+        ARMNN_LOG(fatal) << "Failed to load " << imagePath;
         return nullptr;
     }
 
@@ -51,13 +52,13 @@ std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(uns
     imageStream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
     if (magic != 0x03080000)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << imagePath;
+        ARMNN_LOG(fatal) << "Failed to read " << imagePath;
         return nullptr;
     }
     labelStream.read(reinterpret_cast<char*>(&magic), sizeof(magic));
     if (magic != 0x01080000)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << labelPath;
+        ARMNN_LOG(fatal) << "Failed to read " << labelPath;
         return nullptr;
     }
 
@@ -79,12 +80,12 @@ std::unique_ptr<MnistDatabase::TTestCaseData> MnistDatabase::GetTestCaseData(uns
 
     if (!imageStream.good())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << imagePath;
+        ARMNN_LOG(fatal) << "Failed to read " << imagePath;
         return nullptr;
     }
     if (!labelStream.good())
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to read " << labelPath;
+        ARMNN_LOG(fatal) << "Failed to read " << labelPath;
         return nullptr;
     }
 
index 1a99ed715a3978d9dbb372cfc5be8746d286f61a..1921831fa37b4470161df2c09c5b372f0e05ce9b 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <armnn/TypesUtils.hpp>
 
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 #include <array>
@@ -100,7 +99,7 @@ std::unique_ptr<MobileNetSsdTestCaseData> MobileNetSsdDatabase::GetTestCaseData(
     }
     catch (const InferenceTestImageException& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
+        ARMNN_LOG(fatal) << "Failed to load image for test case " << testCaseId << ". Error: " << e.what();
         return nullptr;
     }
 
index 7beedf8a62f1971f4256b8f0e7ee5605fd43e14b..a950b93c1cc402cab77c0b2dfff96b55f2c25ca4 100644 (file)
@@ -8,7 +8,6 @@
 #include "MobileNetSsdDatabase.hpp"
 
 #include <boost/assert.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 #include <boost/test/tools/floating_point_comparison.hpp>
 
@@ -52,7 +51,7 @@ public:
         const size_t expectedNumDetections = m_DetectedObjects.size();
         if (numDetections != expectedNumDetections)
         {
-            BOOST_LOG_TRIVIAL(error) << "Number of detections is incorrect: Expected (" <<
+            ARMNN_LOG(error) << "Number of detections is incorrect: Expected (" <<
                 expectedNumDetections << ")" << " but got (" << numDetections << ")";
             return TestCaseResult::Failed;
         }
@@ -85,7 +84,7 @@ public:
         {
             if (it == detectedObjects.end())
             {
-                BOOST_LOG_TRIVIAL(error) << "No more detected objects found! Index out of bounds: " << i;
+                ARMNN_LOG(error) << "No more detected objects found! Index out of bounds: " << i;
                 return TestCaseResult::Abort;
             }
 
@@ -94,7 +93,7 @@ public:
 
             if (detectedObject.m_Class != expectedObject.m_Class)
             {
-                BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "Prediction for test case " << this->GetTestCaseId() <<
                     " is incorrect: Expected (" << expectedObject.m_Class << ")" <<
                     " but predicted (" << detectedObject.m_Class << ")";
                 return TestCaseResult::Failed;
@@ -102,7 +101,7 @@ public:
 
             if(!m_FloatComparer(detectedObject.m_Confidence, expectedObject.m_Confidence))
             {
-                BOOST_LOG_TRIVIAL(error) << "Confidence of prediction for test case " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "Confidence of prediction for test case " << this->GetTestCaseId() <<
                     " is incorrect: Expected (" << expectedObject.m_Confidence << ")  +- 1.0 pc" <<
                     " but predicted (" << detectedObject.m_Confidence << ")";
                 return TestCaseResult::Failed;
@@ -113,7 +112,7 @@ public:
                 !m_FloatComparer(detectedObject.m_BoundingBox.m_XMax, expectedObject.m_BoundingBox.m_XMax) ||
                 !m_FloatComparer(detectedObject.m_BoundingBox.m_YMax, expectedObject.m_BoundingBox.m_YMax))
             {
-                BOOST_LOG_TRIVIAL(error) << "Detected bounding box for test case " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "Detected bounding box for test case " << this->GetTestCaseId() <<
                     " is incorrect";
                 return TestCaseResult::Failed;
             }
index ee8e8e4d35f17af2b5860f9ab0fa8dc1a3fec45a..0d7d7689e31762f8fa16103fd562067921d39c70 100644 (file)
@@ -53,7 +53,6 @@ int main(int argc, char* argv[])
         using namespace boost::filesystem;
         armnn::LogSeverity level = armnn::LogSeverity::Debug;
         armnn::ConfigureLogging(true, true, level);
-        armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level);
 
         // Set-up program Options
         namespace po = boost::program_options;
@@ -138,8 +137,8 @@ int main(int argc, char* argv[])
         std::string invalidBackends;
         if (!CheckRequestedBackendsAreValid(computeDevice, armnn::Optional<std::string&>(invalidBackends)))
         {
-            BOOST_LOG_TRIVIAL(fatal) << "The list of preferred devices contains invalid backend IDs: "
-                                     << invalidBackends;
+            ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: "
+                             << invalidBackends;
             return EXIT_FAILURE;
         }
         armnn::Status status;
@@ -166,7 +165,7 @@ int main(int argc, char* argv[])
         {
             std::stringstream message;
             message << "armnn::Exception (" << e.what() << ") caught from optimize.";
-            BOOST_LOG_TRIVIAL(fatal) << message.str();
+            ARMNN_LOG(fatal) << message.str();
             return 1;
         }
 
@@ -175,7 +174,7 @@ int main(int argc, char* argv[])
         status = runtime->LoadNetwork(networkId, std::move(optimizedNet));
         if (status == armnn::Status::Failure)
         {
-            BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to load network";
+            ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to load network";
             return 1;
         }
 
@@ -200,7 +199,7 @@ int main(int argc, char* argv[])
         if (modelOutputLabelsPath.empty() || !boost::filesystem::exists(modelOutputLabelsPath) ||
             !boost::filesystem::is_regular_file(modelOutputLabelsPath))
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Invalid model output labels path at " << modelOutputLabelsPath;
+            ARMNN_LOG(fatal) << "Invalid model output labels path at " << modelOutputLabelsPath;
         }
         const std::vector<armnnUtils::LabelCategoryNames> modelOutputLabels =
             LoadModelOutputLabels(modelOutputLabelsPath);
@@ -211,7 +210,7 @@ int main(int argc, char* argv[])
         size_t imageEndIndex;
         if (imageIndexStrs.size() != 2)
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Invalid validation range specification: Invalid format " << validationRange;
+            ARMNN_LOG(fatal) << "Invalid validation range specification: Invalid format " << validationRange;
             return 1;
         }
         try
@@ -221,7 +220,7 @@ int main(int argc, char* argv[])
         }
         catch (const std::exception& e)
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Invalid validation range specification: " << validationRange;
+            ARMNN_LOG(fatal) << "Invalid validation range specification: " << validationRange;
             return 1;
         }
 
@@ -229,7 +228,7 @@ int main(int argc, char* argv[])
         if (!blacklistPath.empty() &&
             !(boost::filesystem::exists(blacklistPath) && boost::filesystem::is_regular_file(blacklistPath)))
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Invalid path to blacklist file at " << blacklistPath;
+            ARMNN_LOG(fatal) << "Invalid path to blacklist file at " << blacklistPath;
             return 1;
         }
 
@@ -265,7 +264,7 @@ int main(int argc, char* argv[])
             }
             else
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Invalid Data layout: " << inputLayout;
+                ARMNN_LOG(fatal) << "Invalid Data layout: " << inputLayout;
                 return 1;
             }
             const unsigned int inputTensorWidth =
@@ -277,7 +276,7 @@ int main(int argc, char* argv[])
             // Check output tensor shape is valid
             if (modelOutputLabels.size() != outputNumElements)
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Number of output elements: " << outputNumElements
+                ARMNN_LOG(fatal) << "Number of output elements: " << outputNumElements
                                          << " , mismatches the number of output labels: " << modelOutputLabels.size();
                 return 1;
             }
@@ -299,7 +298,7 @@ int main(int argc, char* argv[])
             }
             else
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Unsupported frontend: " << modelFormat;
+                ARMNN_LOG(fatal) << "Unsupported frontend: " << modelFormat;
                 return 1;
             }
             const NormalizationParameters& normParams = GetNormalizationParameters(modelFrontend, inputTensorDataType);
@@ -350,7 +349,7 @@ int main(int argc, char* argv[])
 
                 if (status == armnn::Status::Failure)
                 {
-                    BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to enqueue workload for image: " << imageName;
+                    ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to enqueue workload for image: " << imageName;
                 }
 
                 checker.AddImageResult<TContainer>(imageName, outputDataContainers);
@@ -366,7 +365,7 @@ int main(int argc, char* argv[])
             std::cout << "Top " << i <<  " Accuracy: " << checker.GetAccuracy(i) << "%" << "\n";
         }
 
-        BOOST_LOG_TRIVIAL(info) << "Accuracy Tool ran successfully!";
+        ARMNN_LOG(info) << "Accuracy Tool ran successfully!";
         return 0;
     }
     catch (armnn::Exception const & e)
index fec78ac805fefc8eb08ca89a856f51070711c788..4d45f5df0178c6ec78211465b8ea1fb144d4ebe1 100644 (file)
@@ -6,7 +6,6 @@
 #include <chrono>
 #include <vector>
 #include <array>
-#include <boost/log/trivial.hpp>
 
 #include "armnn/ArmNN.hpp"
 #include "armnn/Utils.hpp"
@@ -32,8 +31,6 @@ int main(int argc, char* argv[])
     {
         // Configures logging for both the ARMNN library and this test program.
         armnn::ConfigureLogging(true, true, level);
-        armnnUtils::ConfigureLogging(boost::log::core::get().get(), true, true, level);
-
         namespace po = boost::program_options;
 
         std::vector<armnn::BackendId> computeDevice;
@@ -98,8 +95,8 @@ int main(int argc, char* argv[])
         std::string invalidBackends;
         if (!CheckRequestedBackendsAreValid(computeDevice, armnn::Optional<std::string&>(invalidBackends)))
         {
-            BOOST_LOG_TRIVIAL(fatal) << "The list of preferred devices contains invalid backend IDs: "
-                                     << invalidBackends;
+            ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: "
+                             << invalidBackends;
             return EXIT_FAILURE;
         }
 
@@ -143,7 +140,7 @@ int main(int argc, char* argv[])
             {
                 std::stringstream message;
                 message << "armnn::Exception ("<<e.what()<<") caught from optimize.";
-                BOOST_LOG_TRIVIAL(fatal) << message.str();
+                ARMNN_LOG(fatal) << message.str();
                 return 1;
             }
 
@@ -152,7 +149,7 @@ int main(int argc, char* argv[])
             status = runtime->LoadNetwork(networkId, std::move(optimizedNet));
             if (status == armnn::Status::Failure)
             {
-                BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to load network";
+                ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to load network";
                 return 1;
             }
 
@@ -195,7 +192,7 @@ int main(int argc, char* argv[])
                     armnnUtils::MakeOutputTensors(outputBindings, outputDataContainers));
                 if (status == armnn::Status::Failure)
                 {
-                    BOOST_LOG_TRIVIAL(fatal) << "armnn::IRuntime: Failed to enqueue workload";
+                    ARMNN_LOG(fatal) << "armnn::IRuntime: Failed to enqueue workload";
                     return 1;
                 }
             }
@@ -209,13 +206,13 @@ int main(int argc, char* argv[])
 
                 if (!std::equal(output0.begin(), output0.end(), outputK.begin(), outputK.end()))
                 {
-                    BOOST_LOG_TRIVIAL(error) << "Multiple networks inference failed!";
+                    ARMNN_LOG(error) << "Multiple networks inference failed!";
                     return 1;
                 }
             }
         }
 
-        BOOST_LOG_TRIVIAL(info) << "Multiple networks inference ran successfully!";
+        ARMNN_LOG(info) << "Multiple networks inference ran successfully!";
         return 0;
     }
     catch (armnn::Exception const& e)
index cbdc327b0b1e0a59d57a90239809cb97e813491e..279bf30e836083a61e942c2671acfb0b2d40218f 100644 (file)
@@ -23,7 +23,6 @@
 #include "CsvReader.hpp"
 #include "../InferenceTest.hpp"
 
-#include <Logging.hpp>
 #include <Profiling.hpp>
 #include <ResolveType.hpp>
 
@@ -62,7 +61,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme
         }
         catch (const std::exception& e)
         {
-            BOOST_LOG_TRIVIAL(error) << "An error occurred when splitting tokens: " << e.what();
+            ARMNN_LOG(error) << "An error occurred when splitting tokens: " << e.what();
             continue;
         }
         for (const std::string& token : tokens)
@@ -75,7 +74,7 @@ std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseEleme
                 }
                 catch (const std::exception&)
                 {
-                    BOOST_LOG_TRIVIAL(error) << "'" << token << "' is not a valid number. It has been ignored.";
+                    ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored.";
                 }
             }
         }
@@ -264,7 +263,7 @@ private:
             }
             else
             {
-                BOOST_LOG_TRIVIAL(info) << "Output Tensor File: " << m_OutputTensorFile << " could not be opened!";
+                ARMNN_LOG(info) << "Output Tensor File: " << m_OutputTensorFile << " could not be opened!";
             }
             outputTensorFile.close();
         }
@@ -335,7 +334,7 @@ void PopulateTensorWithData(TContainer& tensorData,
     else
     {
         std::string errorMessage = "Unsupported tensor data type " + dataTypeStr;
-        BOOST_LOG_TRIVIAL(fatal) << errorMessage;
+        ARMNN_LOG(fatal) << errorMessage;
 
         inputTensorFile.close();
         throw armnn::Exception(errorMessage);
@@ -465,7 +464,7 @@ int MainImpl(const ExecuteNetworkParams& params,
             }
             else
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Unsupported tensor data type \"" << params.m_OutputTypes[i] << "\". ";
+                ARMNN_LOG(fatal) << "Unsupported tensor data type \"" << params.m_OutputTypes[i] << "\". ";
                 return EXIT_FAILURE;
             }
         }
@@ -475,7 +474,7 @@ int MainImpl(const ExecuteNetworkParams& params,
 
         if (params.m_GenerateTensorData)
         {
-            BOOST_LOG_TRIVIAL(warning) << "The input data was generated, note that the output will not be useful";
+            ARMNN_LOG(warning) << "The input data was generated, note that the output will not be useful";
         }
 
         // Print output tensors
@@ -489,28 +488,28 @@ int MainImpl(const ExecuteNetworkParams& params,
             boost::apply_visitor(printer, outputDataContainers[i]);
         }
 
-        BOOST_LOG_TRIVIAL(info) << "\nInference time: " << std::setprecision(2)
+        ARMNN_LOG(info) << "\nInference time: " << std::setprecision(2)
                                 << std::fixed << inference_duration.count() << " ms";
 
         // If thresholdTime == 0.0 (default), then it hasn't been supplied at command line
         if (params.m_ThresholdTime != 0.0)
         {
-            BOOST_LOG_TRIVIAL(info) << "Threshold time: " << std::setprecision(2)
+            ARMNN_LOG(info) << "Threshold time: " << std::setprecision(2)
                                     << std::fixed << params.m_ThresholdTime << " ms";
             auto thresholdMinusInference = params.m_ThresholdTime - inference_duration.count();
-            BOOST_LOG_TRIVIAL(info) << "Threshold time - Inference time: " << std::setprecision(2)
+            ARMNN_LOG(info) << "Threshold time - Inference time: " << std::setprecision(2)
                                     << std::fixed << thresholdMinusInference << " ms" << "\n";
 
             if (thresholdMinusInference < 0)
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Elapsed inference time is greater than provided threshold time.\n";
+                ARMNN_LOG(fatal) << "Elapsed inference time is greater than provided threshold time.\n";
                 return EXIT_FAILURE;
             }
         }
     }
     catch (armnn::Exception const& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Armnn Error: " << e.what();
+        ARMNN_LOG(fatal) << "Armnn Error: " << e.what();
         return EXIT_FAILURE;
     }
 
@@ -562,27 +561,27 @@ int RunTest(const std::string& format,
     }
     else
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'";
+        ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Please include 'binary' or 'text'";
         return EXIT_FAILURE;
     }
 
     if ((inputTensorShapesVector.size() != 0) && (inputTensorShapesVector.size() != inputNamesVector.size()))
     {
-        BOOST_LOG_TRIVIAL(fatal) << "input-name and input-tensor-shape must have the same amount of elements.";
+        ARMNN_LOG(fatal) << "input-name and input-tensor-shape must have the same amount of elements.";
         return EXIT_FAILURE;
     }
 
     if ((inputTensorDataFilePathsVector.size() != 0) &&
         (inputTensorDataFilePathsVector.size() != inputNamesVector.size()))
     {
-        BOOST_LOG_TRIVIAL(fatal) << "input-name and input-tensor-data must have the same amount of elements.";
+        ARMNN_LOG(fatal) << "input-name and input-tensor-data must have the same amount of elements.";
         return EXIT_FAILURE;
     }
 
     if ((outputTensorFilesVector.size() != 0) &&
         (outputTensorFilesVector.size() != outputNamesVector.size()))
     {
-        BOOST_LOG_TRIVIAL(fatal) << "output-name and write-outputs-to-file must have the same amount of elements.";
+        ARMNN_LOG(fatal) << "output-name and write-outputs-to-file must have the same amount of elements.";
         return EXIT_FAILURE;
     }
 
@@ -593,7 +592,7 @@ int RunTest(const std::string& format,
     }
     else if ((inputTypesVector.size() != 0) && (inputTypesVector.size() != inputNamesVector.size()))
     {
-        BOOST_LOG_TRIVIAL(fatal) << "input-name and input-type must have the same amount of elements.";
+        ARMNN_LOG(fatal) << "input-name and input-type must have the same amount of elements.";
         return EXIT_FAILURE;
     }
 
@@ -604,7 +603,7 @@ int RunTest(const std::string& format,
     }
     else if ((outputTypesVector.size() != 0) && (outputTypesVector.size() != outputNamesVector.size()))
     {
-        BOOST_LOG_TRIVIAL(fatal) << "output-name and output-type must have the same amount of elements.";
+        ARMNN_LOG(fatal) << "output-name and output-type must have the same amount of elements.";
         return EXIT_FAILURE;
     }
 
@@ -627,7 +626,7 @@ int RunTest(const std::string& format,
             }
             catch (const armnn::InvalidArgumentException& e)
             {
-                BOOST_LOG_TRIVIAL(fatal) << "Cannot create tensor shape: " << e.what();
+                ARMNN_LOG(fatal) << "Cannot create tensor shape: " << e.what();
                 return EXIT_FAILURE;
             }
         }
@@ -636,7 +635,7 @@ int RunTest(const std::string& format,
     // Check that threshold time is not less than zero
     if (thresholdTime < 0)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Threshold time supplied as a command line argument is less than zero.";
+        ARMNN_LOG(fatal) << "Threshold time supplied as a command line argument is less than zero.";
         return EXIT_FAILURE;
     }
 
@@ -665,7 +664,7 @@ int RunTest(const std::string& format,
     // Warn if ExecuteNetwork will generate dummy input data
     if (params.m_GenerateTensorData)
     {
-        BOOST_LOG_TRIVIAL(warning) << "No input files provided, input tensors will be filled with 0s.";
+        ARMNN_LOG(warning) << "No input files provided, input tensors will be filled with 0s.";
     }
 
     // Forward to implementation based on the parser type
@@ -674,7 +673,7 @@ int RunTest(const std::string& format,
 #if defined(ARMNN_SERIALIZER)
     return MainImpl<armnnDeserializer::IDeserializer, float>(params, runtime);
 #else
-    BOOST_LOG_TRIVIAL(fatal) << "Not built with serialization support.";
+        ARMNN_LOG(fatal) << "Not built with serialization support.";
     return EXIT_FAILURE;
 #endif
     }
@@ -683,7 +682,7 @@ int RunTest(const std::string& format,
 #if defined(ARMNN_CAFFE_PARSER)
         return MainImpl<armnnCaffeParser::ICaffeParser, float>(params, runtime);
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Not built with Caffe parser support.";
+        ARMNN_LOG(fatal) << "Not built with Caffe parser support.";
         return EXIT_FAILURE;
 #endif
     }
@@ -692,7 +691,7 @@ int RunTest(const std::string& format,
 #if defined(ARMNN_ONNX_PARSER)
     return MainImpl<armnnOnnxParser::IOnnxParser, float>(params, runtime);
 #else
-    BOOST_LOG_TRIVIAL(fatal) << "Not built with Onnx parser support.";
+        ARMNN_LOG(fatal) << "Not built with Onnx parser support.";
     return EXIT_FAILURE;
 #endif
     }
@@ -701,7 +700,7 @@ int RunTest(const std::string& format,
 #if defined(ARMNN_TF_PARSER)
         return MainImpl<armnnTfParser::ITfParser, float>(params, runtime);
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Not built with Tensorflow parser support.";
+        ARMNN_LOG(fatal) << "Not built with Tensorflow parser support.";
         return EXIT_FAILURE;
 #endif
     }
@@ -710,20 +709,20 @@ int RunTest(const std::string& format,
 #if defined(ARMNN_TF_LITE_PARSER)
         if (! isModelBinary)
         {
-            BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat << "'. Only 'binary' format supported \
+            ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat << "'. Only 'binary' format supported \
               for tflite files";
             return EXIT_FAILURE;
         }
         return MainImpl<armnnTfLiteParser::ITfLiteParser, float>(params, runtime);
 #else
-        BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat <<
+        ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat <<
             "'. Please include 'caffe', 'tensorflow', 'tflite' or 'onnx'";
         return EXIT_FAILURE;
 #endif
     }
     else
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Unknown model format: '" << modelFormat <<
+        ARMNN_LOG(fatal) << "Unknown model format: '" << modelFormat <<
                                  "'. Please include 'caffe', 'tensorflow', 'tflite' or 'onnx'";
         return EXIT_FAILURE;
     }
@@ -797,7 +796,7 @@ int RunCsvTest(const armnnUtils::CsvRow &csvRow, const std::shared_ptr<armnn::IR
         // and that desc.add_options() can throw boost::io::too_few_args.
         // They really won't in any of these cases.
         BOOST_ASSERT_MSG(false, "Caught unexpected exception");
-        BOOST_LOG_TRIVIAL(fatal) << "Fatal internal error: " << e.what();
+        ARMNN_LOG(fatal) << "Fatal internal error: " << e.what();
         return EXIT_FAILURE;
     }
 
@@ -837,7 +836,7 @@ int RunCsvTest(const armnnUtils::CsvRow &csvRow, const std::shared_ptr<armnn::IR
     std::string invalidBackends;
     if (!CheckRequestedBackendsAreValid(computeDevices, armnn::Optional<std::string&>(invalidBackends)))
     {
-        BOOST_LOG_TRIVIAL(fatal) << "The list of preferred devices contains invalid backend IDs: "
+        ARMNN_LOG(fatal) << "The list of preferred devices contains invalid backend IDs: "
                                  << invalidBackends;
         return EXIT_FAILURE;
     }
index 472fc8083dc8af19904eae3d0ebf4a22b8f123bb..98db8d48718f43db4972175bb8e3b91bc22e6889 100644 (file)
@@ -5,6 +5,7 @@
 #include "YoloDatabase.hpp"
 
 #include <armnn/Exceptions.hpp>
+#include <armnn/Logging.hpp>
 
 #include <array>
 #include <cstdint>
@@ -13,7 +14,6 @@
 
 #include <boost/assert.hpp>
 #include <boost/format.hpp>
-#include <boost/log/trivial.hpp>
 #include <boost/numeric/conversion/cast.hpp>
 
 #include "InferenceTestImage.hpp"
@@ -91,7 +91,7 @@ std::unique_ptr<YoloDatabase::TTestCaseData> YoloDatabase::GetTestCaseData(unsig
     }
     catch (const InferenceTestImageException& e)
     {
-        BOOST_LOG_TRIVIAL(fatal) << "Failed to load test case " << testCaseId << " with error: " << e.what();
+        ARMNN_LOG(fatal) << "Failed to load test case " << testCaseId << " with error: " << e.what();
         return nullptr;
     }
 
index eb6b22767b7a4e7a071aa8f94fe820c956794a54..91ea97771ca4701ca6987dd575099fe346297e0a 100644 (file)
@@ -145,7 +145,7 @@ public:
             const YoloDetectedObject& detectedObject = *outputIt;
             if (detectedObject.m_Class != expectedDetection.m_Class)
             {
-                BOOST_LOG_TRIVIAL(error) << "Prediction for test case " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "Prediction for test case " << this->GetTestCaseId() <<
                     " is incorrect: Expected (" << expectedDetection.m_Class << ")" <<
                     " but predicted (" << detectedObject.m_Class << ")";
                 return TestCaseResult::Failed;
@@ -157,7 +157,7 @@ public:
                 !m_FloatComparer(detectedObject.m_Box.m_H, expectedDetection.m_Box.m_H) ||
                 !m_FloatComparer(detectedObject.m_Confidence, expectedDetection.m_Confidence))
             {
-                BOOST_LOG_TRIVIAL(error) << "Detected bounding box for test case " << this->GetTestCaseId() <<
+                ARMNN_LOG(error) << "Detected bounding box for test case " << this->GetTestCaseId() <<
                     " is incorrect";
                 return TestCaseResult::Failed;
             }