HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onnxruntime::logging::LoggingManager Class Referencefinal

The logging manager. Owns the log sink and potentially provides a default Logger instance. Provides filtering based on a minimum LogSeverity level, and of messages with DataType::User if enabled. More...

#include <logging.h>

Public Types

enum  InstanceType { Default, Temporal }
 

Public Member Functions

 LoggingManager (std::unique_ptr< ISink > sink, Severity default_min_severity, bool default_filter_user_data, InstanceType instance_type, const std::string *default_logger_id=nullptr, int default_max_vlog_level=-1)
 
std::unique_ptr< LoggerCreateLogger (const std::string &logger_id)
 
std::unique_ptr< LoggerCreateLogger (const std::string &logger_id, Severity min_severity, bool filter_user_data, int max_vlog_level=-1)
 
void Log (const std::string &logger_id, const Capture &message) const
 
void SendProfileEvent (profiling::EventRecord &eventRecord) const
 
 ~LoggingManager ()
 

Static Public Member Functions

static const LoggerDefaultLogger ()
 
static bool HasDefaultLogger ()
 
static void SetDefaultLoggerSeverity (Severity severity)
 
static void SetDefaultLoggerVerbosity (int vlog_level)
 
static std::exception LogFatalAndCreateException (const char *category, const CodeLocation &location, const char *format_str,...)
 

Detailed Description

The logging manager. Owns the log sink and potentially provides a default Logger instance. Provides filtering based on a minimum LogSeverity level, and of messages with DataType::User if enabled.

Definition at line 102 of file logging.h.

Member Enumeration Documentation

Enumerator
Default 

Default instance of LoggingManager that should exist for the lifetime of the program.

Temporal 

Temporal instance. CreateLogger(...) should be used, however DefaultLogger() will NOT be provided via this instance.

Definition at line 104 of file logging.h.

Constructor & Destructor Documentation

onnxruntime::logging::LoggingManager::LoggingManager ( std::unique_ptr< ISink sink,
Severity  default_min_severity,
bool  default_filter_user_data,
InstanceType  instance_type,
const std::string default_logger_id = nullptr,
int  default_max_vlog_level = -1 
)

Initializes a new instance of the LoggingManager class.

Parameters
sinkThe sink to write to. Use CompositeSink if you need to write to multiple places.
default_min_severityThe default minimum severity. Messages with lower severity will be ignored unless overridden in CreateLogger.
default_filter_user_dataIf set to true ignore messages with DataType::USER unless overridden in CreateLogger.
instance_typeIf InstanceType::Default, this is the default instance of the LoggingManager and is expected to exist for the lifetime of the program. It creates and owns the default logger that calls to the static DefaultLogger method return.
default_logger_idLogger Id to use for the default logger. nullptr/ignored if instance_type == Temporal.
default_max_vlog_levelDefault maximum level for VLOG messages to be created unless overridden in CreateLogger. Requires a severity of kVERBOSE for VLOG messages to be logged.
onnxruntime::logging::LoggingManager::~LoggingManager ( )

Member Function Documentation

std::unique_ptr<Logger> onnxruntime::logging::LoggingManager::CreateLogger ( const std::string logger_id)

Creates a new logger instance which will use the provided logger_id and default severity and vlog levels.

Parameters
logger_idThe log identifier.
Returns
A new Logger instance that the caller owns.
std::unique_ptr<Logger> onnxruntime::logging::LoggingManager::CreateLogger ( const std::string logger_id,
Severity  min_severity,
bool  filter_user_data,
int  max_vlog_level = -1 
)

Creates a new logger instance which will use the provided logger_id, severity and vlog levels.

Parameters
logger_idThe log identifier.
min_severityThe minimum severity. Requests to create messages with lower severity will be ignored.
filter_user_dataIf set to true ignore messages with DataType::USER.
max_vlog_levelMaximum level for VLOG messages to be created.
Returns
A new Logger instance that the caller owns.
const Logger & onnxruntime::logging::LoggingManager::DefaultLogger ( )
inlinestatic

Gets the default logger instance if set. Throws if no default logger is currently registered.

Remarks
Creating a LoggingManager instance with is_default_instance == true registers a default logger. Note that the default logger is only valid until the LoggerManager that registered it is destroyed.
Returns
The default logger if available.

Definition at line 306 of file logging.h.

static bool onnxruntime::logging::LoggingManager::HasDefaultLogger ( )
inlinestatic

Return a boolean indicating if the default logger has been initialized

Definition at line 157 of file logging.h.

void onnxruntime::logging::LoggingManager::Log ( const std::string logger_id,
const Capture message 
) const

Logs the message using the provided logger id.

Parameters
logger_idThe log identifier.
messageThe log message.
static std::exception onnxruntime::logging::LoggingManager::LogFatalAndCreateException ( const char *  category,
const CodeLocation location,
const char *  format_str,
  ... 
)
static

Logs a FATAL level message and creates an exception that can be thrown with error information.

Parameters
categoryThe log category.
locationThe location the log message was generated.
format_strThe printf format string.
...The printf arguments.
Returns
A new Logger instance that the caller owns.
void onnxruntime::logging::LoggingManager::SendProfileEvent ( profiling::EventRecord eventRecord) const

Sends a Profiling Event Record to the sink.

Parameters
ProfilingEvent Record
void onnxruntime::logging::LoggingManager::SetDefaultLoggerSeverity ( Severity  severity)
inlinestatic

Change the minimum severity level for log messages to be output by the default logger.

Parameters
severityThe severity.

Definition at line 315 of file logging.h.

void onnxruntime::logging::LoggingManager::SetDefaultLoggerVerbosity ( int  vlog_level)
inlinestatic

Change the maximum verbosity level for log messages to be output by the default logger.

Remarks
To activate the verbose log, the logger severity must also be set to kVERBOSE.
Parameters
vlog_levelThe verbosity level.

Definition at line 324 of file logging.h.


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