Embedded Multicore Building Blocks V1.0.0
Static Public Member Functions | List of all members
embb::base::Log Class Reference

Simple logging facilities. More...

#include <log.h>

Static Public Member Functions

static void SetLogLevel (embb_log_level_t log_level)
 Sets the global log level. More...
 
static void SetLogFunction (void *context, embb_log_function_t func)
 Sets the global logging function. More...
 
static void Write (char const *channel, embb_log_level_t log_level, char const *message,...)
 Logs a message to the given channel with the specified log level. More...
 
static void Trace (char const *channel, char const *message,...)
 Logs a message to the given channel with EMBB_LOG_LEVEL_TRACE. More...
 
static void Info (char const *channel, char const *message,...)
 Logs a message to the given channel with EMBB_LOG_LEVEL_INFO. More...
 
static void Warning (char const *channel, char const *message,...)
 Logs a message to the given channel with EMBB_LOG_LEVEL_WARNING. More...
 
static void Error (char const *channel, char const *message,...)
 Logs a message to the given channel with EMBB_LOG_LEVEL_ERROR. More...
 

Detailed Description

Simple logging facilities.

Member Function Documentation

static void embb::base::Log::SetLogLevel ( embb_log_level_t  log_level)
static

Sets the global log level.

This determines what messages will be shown, messages with a more detailed log level will be filtered out. The default log level is EMBB_LOG_LEVEL_NONE.

Concurrency
Not thread-safe
Parameters
[in]log_levelLog level to use for filtering
static void embb::base::Log::SetLogFunction ( void *  context,
embb_log_function_t  func 
)
static

Sets the global logging function.

The logging function implements the mechanism for transferring log messages to their destination. context is a pointer to data the user needs in the function to determine where the messages should go (may be NULL if no additional data is needed). The default logging function is embb_log_write_file() with context set to stdout.

See also
embb_log_function_t
Concurrency
Not thread-safe
Parameters
[in]contextUser context to supply as the first parameter of the logging function
[in]funcThe logging function
static void embb::base::Log::Write ( char const *  channel,
embb_log_level_t  log_level,
char const *  message,
  ... 
)
static

Logs a message to the given channel with the specified log level.

If the log level is greater than the configured log level for the channel, the message will be ignored.

See also
embb::base::Log::SetLogLevel, embb::base::Log::SetLogFunction
Concurrency
Thread-safe
Parameters
[in]channelUser specified channel id for filtering the log later on. Might be NULL, channel identifier will be "global" in that case
[in]log_levelLog level to use
[in]messageMessage to convey, may use printf style formatting
static void embb::base::Log::Trace ( char const *  channel,
char const *  message,
  ... 
)
static

Logs a message to the given channel with EMBB_LOG_LEVEL_TRACE.

In non-debug builds, this function does nothing.

See also
embb::base::Log::Write
Concurrency
Thread-safe
Parameters
[in]channelUser specified channel id
[in]messageMessage to convey, may use printf style formatting
static void embb::base::Log::Info ( char const *  channel,
char const *  message,
  ... 
)
static

Logs a message to the given channel with EMBB_LOG_LEVEL_INFO.

In non-debug builds, this function does nothing.

See also
embb::base::Log::Write
Concurrency
Thread-safe
Parameters
[in]channelUser specified channel id
[in]messageMessage to convey, may use printf style formatting
static void embb::base::Log::Warning ( char const *  channel,
char const *  message,
  ... 
)
static

Logs a message to the given channel with EMBB_LOG_LEVEL_WARNING.

See also
embb::base::Log::Write
Concurrency
Thread-safe
Parameters
[in]channelUser specified channel id
[in]messageMessage to convey, may use printf style formatting
static void embb::base::Log::Error ( char const *  channel,
char const *  message,
  ... 
)
static

Logs a message to the given channel with EMBB_LOG_LEVEL_ERROR.

See also
embb::base::Log::Write
Concurrency
Thread-safe
Parameters
[in]channelUser specified channel id
[in]messageMessage to convey, may use printf style formatting