ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::LoggerConfig Class Referencefinal

Logger Configuration. More...

#include <Log.h>

Collaboration diagram for luci::LoggerConfig:

Public Member Functions

 LoggerConfig ()
 
void configure (const hermes::Source *, hermes::Source::Setting &) const final
 
void configure (const Logger *, hermes::Source::Setting &) const
 
- Public Member Functions inherited from hermes::Config
virtual ~Config ()=default
 

Detailed Description

Logger Configuration.

Users are able to turn logging on/off via LUCI_LOG environment variable.

Definition at line 40 of file Log.h.

Constructor & Destructor Documentation

◆ LoggerConfig()

luci::LoggerConfig::LoggerConfig ( )

Definition at line 60 of file Log.cpp.

61{
62 auto settings = luci::UserSettings::settings();
63
64 _show_warn = !settings->get(luci::UserSettings::Key::MuteWarnings);
65
66 // Turn on verbose logging if LUCI_LOG is set to some level
67 // VERBOSE(l, 1) will be visible with LUCI_LOG=2 and VERBOSE(l, 2) with LUCI_LOG=3 and so on
68 _show_verbose = safecast<int>(std::getenv("LUCI_LOG"), 0);
69}
static UserSettings * settings()

References luci::UserSettings::MuteWarnings, and luci::UserSettings::settings().

Member Function Documentation

◆ configure() [1/2]

void luci::LoggerConfig::configure ( const hermes::Source source,
hermes::Source::Setting setting 
) const
finalvirtual

Implements hermes::Config.

Definition at line 71 of file Log.cpp.

72{
73 // Let's ignore hermes::Sources if that is not a moco logger
74 if (auto logger = dynamic_cast<const Logger *>(source))
75 {
76 configure(logger, setting);
77 }
78}
void configure(const hermes::Source *, hermes::Source::Setting &) const final
Definition Log.cpp:71

References configure().

Referenced by configure().

◆ configure() [2/2]

void luci::LoggerConfig::configure ( const Logger ,
hermes::Source::Setting setting 
) const

Definition at line 80 of file Log.cpp.

81{
82 setting.reject_all();
85 if (_show_warn)
86 {
88 }
91}
void accept_upto(uint16_t lv)
Filter filter(const SeverityCategory &cat)
@ FATAL
Definition Severity.h:33
@ ERROR
Definition Severity.h:34
@ VERBOSE
Definition Severity.h:37
@ INFO
Definition Severity.h:36
@ WARN
Definition Severity.h:35

References hermes::Filter::accept_upto(), hermes::ERROR, hermes::FATAL, hermes::SourceSetting::filter(), hermes::INFO, hermes::SourceSetting::reject_all(), hermes::VERBOSE, and hermes::WARN.


The documentation for this class was generated from the following files: