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

Logger Configuration. More...

#include <Log.h>

Collaboration diagram for tflchef::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 TFLCHEF_LOG environment variable.

Definition at line 40 of file Log.h.

Constructor & Destructor Documentation

◆ LoggerConfig()

tflchef::LoggerConfig::LoggerConfig ( )

Definition at line 58 of file Log.cpp.

59{
60 // Turn on logging if TFLCHEF_LOG is set as non-zero value
61 _enabled = safecast<bool>(std::getenv("TFLCHEF_LOG"), false);
62}

Member Function Documentation

◆ configure() [1/2]

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

Implements hermes::Config.

Definition at line 64 of file Log.cpp.

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

References configure().

Referenced by configure().

◆ configure() [2/2]

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

Definition at line 73 of file Log.cpp.

74{
75 if (_enabled)
76 {
77 // Enable all catagories
78 setting.accept_all();
79 }
80 else
81 {
82 // Disable all catagories
83 setting.reject_all();
84 }
85}

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


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