Class vart::Logger#
-
class Logger#
The logger module provides the logging support for VART modules.
Supports logging to console, file, syslog.
Public Functions
-
std::shared_ptr<struct log_context> mod_register(const char *modname, bool need_id)#
mod_register() - Registers a module with logger object
If the module is already registered with the logger, its instance id is incremented, else a default instance id = 0 is assigned. Module instance log level is assigned from logger object’s database or from global log level if per module log level is not provided by user. If need_id is set to false, module instance id is not appended to module’s instance name. Components such as ‘videoframe’, ‘memory’ need to set this flag to false as there can be too many instances of those components in a single pipeline use case and can be be distinguished by their pointers. Components representing IP blocks can set this to true to distinguish IP instances.
- Parameters:
modname – Module name to register with logger
need_id – Flag describing the need for an id to be appended to module name during logging
- Returns:
Returns logger context associated with a module instance.
vart_logger_log_obj() - Logs a module’s message along with metadata like filename, function name, line number, process id, thread id.
- Parameters:
LogLevel – Logging level with which module logs a message
ctx – Module’s logger context obtained with mod_register()
filename – Source code filename from which this logging is triggered
func – Source code function name
line – Source code line number
fmt – Format string passed for logging.
Public Static Functions
-
static inline Logger &get_instance()#
get_instance() - Creates a logger() instance if not created earlier, else return an existing instance.
Logger object when created reads the environment variable VART_CORE_DEBUG to get and store log levels of each module and global log level. Default module instance id is stored as -1. This id will be updated later when each module instance registers with logger. Apart from that, logger reads the environment variable VART_LOG_FILE_PATH and if:
VART_LOG_FILE_PATH is set to CONSOLE, logs messages to on screen console.
VART_LOG_FILE_PATH is set to SYSLOG, appends log messages to syslog.
VART_LOG_FILE_PATH is set to a file on disk, log messages to that file. If the file cannot be opened to log, defaults to syslog logging.
- Returns:
Returns a logger instance
-
std::shared_ptr<struct log_context> mod_register(const char *modname, bool need_id)#