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

Logger Configuration. More...

#include <Log.h>

Collaboration diagram for exo::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 EXO_LOG environment variable.

Definition at line 42 of file Log.h.

Constructor & Destructor Documentation

◆ LoggerConfig()

exo::LoggerConfig::LoggerConfig ( )

Definition at line 54 of file Log.cpp.

55{
56 // Turn on logging if EXO_LOG is set as non-zero value
57 _enabled = safecast<bool>(std::getenv("EXO_LOG"), false);
58}

Member Function Documentation

◆ configure() [1/2]

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

Implements hermes::Config.

Definition at line 60 of file Log.cpp.

61{
62 // Let's ignore hermes::Sources if that is not a exo logger
63 if (auto logger = dynamic_cast<const Logger *>(source))
64 {
65 configure(logger, setting);
66 }
67}
void configure(const hermes::Source *, hermes::Source::Setting &) const final
Definition Log.cpp:60

References configure().

Referenced by configure().

◆ configure() [2/2]

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

Definition at line 69 of file Log.cpp.

70{
71 if (_enabled)
72 {
73 // Enable all catagories
74 setting.accept_all();
75 }
76 else
77 {
78 // Disable all catagories
79 setting.reject_all();
80 }
81}

References hermes::SourceSetting::accept_all(), and hermes::SourceSetting::reject_all().


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