Skip to navigation

holoscan::logger::Logger

Beta
View as Markdown

Logger class for logging messages.

Provides a flexible, customizable logging system that can dispatch to a custom ILogger or a custom LogFunction. The custom log function takes priority over the custom logger; if neither is set, no logging occurs.

#include <holoscan/logger/spdlog_logger.hpp>

Constructors

Logger

holoscan::logger::Logger::Logger() = default

Methods

log

HOLOSCAN_LOGGER_EXPORT void holoscan::logger::Logger::log(
const char *file,
int line,
const char *name,
int level,
const char *message
)

Log a message using either the custom log function (preferred) or the custom logger.

logger

HOLOSCAN_LOGGER_EXPORT void holoscan::logger::Logger::logger(
std::shared_ptr<ILogger> custom_logger
)

Set / get a custom logger.

func

HOLOSCAN_LOGGER_EXPORT void holoscan::logger::Logger::func(
LogFunction log_func,
void *func_arg = nullptr
)

Set a custom log function and an opaque argument passed back to it.

arg

HOLOSCAN_LOGGER_EXPORT void * holoscan::logger::Logger::arg() const

Get the current custom log function argument.

pattern

HOLOSCAN_LOGGER_EXPORT void holoscan::logger::Logger::pattern(
const char *pattern
)

Set / get the log message pattern.

level

HOLOSCAN_LOGGER_EXPORT void holoscan::logger::Logger::level(
int level
)

Set / get the log level.

redirect

HOLOSCAN_LOGGER_EXPORT void holoscan::logger::Logger::redirect(
int level,
void *output
)

Redirect log output for a given level, and query the current redirection.


Member variables

NameTypeDescription
logger_std::shared_ptr< ILogger >shared pointer to the logger
func_LogFunctionlog function
func_arg_void *log function argument
pattern_std::stringlog pattern
level_intlog level
sinks_std::vector< void * >log sinks