39 std::transform(level.begin(), level.end(), level.begin(),
40 [](
unsigned char c){
return std::tolower(c); }
47 else if (level ==
"debug")
51 else if (level ==
"info")
55 else if (level ==
"warning")
59 else if (level ==
"error")
63 else if (level ==
"fatal")
70 "'. Valid options: trace, debug, info, warning, error, fatal");
79 virtual void Consume(
const std::string&) = 0;
87 void Consume(
const std::string& s)
override 89 std::cout << s << std::endl;
109 for (
auto sink : m_LogSinks)
113 sink->Consume(m_Os.str());
124 : m_LogSinks(other.m_LogSinks)
125 , m_Os(
std::move(other.m_Os))
126 , m_Enabled(other.m_Enabled)
130 other.m_Enabled =
false;
133 template<
typename Streamable>
144 const std::vector<std::shared_ptr<LogSink>>& m_LogSinks;
145 std::ostringstream m_Os;
149 template<LogSeverity Level>
154 : m_Sinks{std::make_shared<StandardOutputSink>()}
178 m_Sinks.push_back(sink);
181 std::vector<std::shared_ptr<LogSink>> m_Sinks;
205 #define ARMNN_LOG(severity) \ 206 armnn::SimpleLogger<ConvertLogSeverity(armnn::BoostLogSeverityMapping::severity)>::Get().StartNewRecord()
ScopedRecord StartNewRecord()
ScopedRecord(const std::vector< std::shared_ptr< LogSink >> &sinks, LogSeverity level, bool enabled)
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
ScopedRecord(ScopedRecord &&other)
void Enable(bool enable=true)
std::string LevelToString(LogSeverity level)
LogSeverity StringToLogLevel(std::string level)
Copyright (c) 2021 ARM Limited and Contributors.
void SetLogFilter(LogSeverity level)
constexpr LogSeverity ConvertLogSeverity(BoostLogSeverityMapping severity)
ScopedRecord & operator<<(const Streamable &s)
Base class for all ArmNN exceptions so that users can filter to just those.
void AddSink(std::shared_ptr< LogSink > sink)
virtual void Consume(const std::string &)=0
void Consume(const std::string &s) override