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());
125 template<
typename Streamable>
136 const std::vector<std::shared_ptr<LogSink>>& m_LogSinks;
137 std::ostringstream m_Os;
141 template<LogSeverity Level>
146 : m_Sinks{std::make_shared<StandardOutputSink>()}
175 m_Sinks.push_back(sink);
178 std::vector<std::shared_ptr<LogSink>> m_Sinks;
202 #define ARMNN_LOG(severity) \ 203 armnn::SimpleLogger<ConvertLogSeverity(armnn::BoostLogSeverityMapping::severity)>::Get().StartNewRecord()
static SimpleLogger & Get()
ScopedRecord StartNewRecord()
ScopedRecord(const std::vector< std::shared_ptr< LogSink >> &sinks, LogSeverity level, bool enabled)
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
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