Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Logging

Modules

 Colors
 ANSI/VT100 colors as understood by most consoles and terminals.
 

Data Structures

struct  sol_log_domain
 Structure containing the attributes of the domain used for logging. More...
 

Macros

#define SOL_CRI(fmt,...)   SOL_LOG(SOL_LOG_LEVEL_CRITICAL, fmt, ## __VA_ARGS__)
 Logs a message with critical level. More...
 
#define SOL_DBG(fmt,...)   SOL_LOG(SOL_LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__)
 Logs a message with debug level. More...
 
#define SOL_ERR(fmt,...)   SOL_LOG(SOL_LOG_LEVEL_ERROR, fmt, ## __VA_ARGS__)
 Logs a message with error level. More...
 
#define SOL_EXP_CHECK(exp,...)
 Safety-check macro to check the expression exp. More...
 
#define SOL_EXP_CHECK_GOTO(exp, label)
 Similar to SOL_EXP_CHECK but jumping to label instead of returning. More...
 
#define SOL_INF(fmt,...)   SOL_LOG(SOL_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__)
 Logs a message with informational level. More...
 
#define SOL_INT_CHECK(var, exp,...)   SOL_INT_CHECK_IMPL(var, exp, __VA_ARGS__)
 Safety-check macro to check if integer var against exp. More...
 
#define SOL_INT_CHECK_ERRNO(var, exp, err,...)   SOL_INT_CHECK_IMPL_ERRNO(var, exp, err, __VA_ARGS__)
 Safety-check macro to check if integer var against exp (and set errno). More...
 
#define SOL_INT_CHECK_GOTO(var, exp, label)   SOL_INT_CHECK_GOTO_IMPL(var, exp, label)
 Similar to SOL_INT_CHECK but jumping to label instead of returning. More...
 
#define SOL_INT_CHECK_GOTO_ERRNO(var, exp, err, label)   SOL_INT_CHECK_GOTO_IMPL_ERRNO(var, exp, label)
 Similar to SOL_INT_CHECK but jumping to label instead of returning (and setting errno value). More...
 
#define SOL_LOG(level, fmt,...)
 Logs to SOL_LOG_DOMAIN using the given level and format message. More...
 
#define SOL_LOG_DOMAIN   sol_log_global_domain
 Defines the default log domain that is used by SOL_LOG(), SOL_CRI(), SOL_ERR(), SOL_WRN(), SOL_INF() and SOL_DBG(). More...
 
#define SOL_LOG_FILE   ""
 Macro defining what to log for file entries. More...
 
#define SOL_LOG_FUNCTION   ""
 Macro defining what to log for function entries. More...
 
#define SOL_LOG_LEVEL_INIT()
 Sets the global log level based on the SOL_LOG_LEVEL macro. More...
 
#define SOL_LOG_LEVEL_MAXIMUM   -1
 Ensures a maximum log level. More...
 
#define SOL_LOG_LEVEL_POSSIBLE(level)   (0)
 Check if log level is possible. More...
 
#define SOL_LOG_LEVELS_INIT()
 Sets the log level of the given log domains. More...
 
#define SOL_NULL_CHECK(ptr,...)
 Convenience macro to check for NULL pointer. More...
 
#define SOL_NULL_CHECK_ERRNO(ptr, err,...)
 Convenience macro to check for NULL pointer (and set errno). More...
 
#define SOL_NULL_CHECK_GOTO(ptr, label)
 Convenience macro to check for NULL pointer and jump to a given label. More...
 
#define SOL_NULL_CHECK_MSG(ptr, ret, fmt,...)
 Similar to SOL_NULL_CHECK but allowing for a custom warning message. More...
 
#define SOL_NULL_CHECK_MSG_GOTO(ptr, label, fmt,...)
 Similar to SOL_NULL_CHECK_GOTO but allowing for a custom warning message. More...
 
#define SOL_WRN(fmt,...)   SOL_LOG(SOL_LOG_LEVEL_WARNING, fmt, ## __VA_ARGS__)
 Logs a message with warning level. More...
 

Typedefs

typedef struct sol_log_domain sol_log_domain
 Structure containing the attributes of the domain used for logging. More...
 

Enumerations

enum  sol_log_level {
  SOL_LOG_LEVEL_CRITICAL = 0, SOL_LOG_LEVEL_ERROR, SOL_LOG_LEVEL_WARNING, SOL_LOG_LEVEL_INFO,
  SOL_LOG_LEVEL_DEBUG
}
 Available logging levels. More...
 

Functions

static void sol_log_domain_init_level (struct sol_log_domain *domain)
 Initialize domain log level based on system configuration. More...
 
static uint8_t sol_log_get_abort_level (void)
 Get the logging level that triggers the program to abort. More...
 
static uint8_t sol_log_get_level (void)
 Get the maximum log level allowed. More...
 
static const char * sol_log_get_level_color (uint8_t level)
 Get the color code used for the given logging level level. More...
 
static bool sol_log_get_show_colors (void)
 Get if color output is enabled or not. More...
 
static bool sol_log_get_show_file (void)
 Get if showing source file's name is enabled or not. More...
 
static bool sol_log_get_show_function (void)
 Get if showing function's name is enabled or not. More...
 
static bool sol_log_get_show_line (void)
 Get if showing the line number is enabled or not. More...
 
static void sol_log_level_to_str (uint8_t level, char *buf, size_t buflen)
 Convenience function to convert the logging level to string. More...
 
static void sol_log_print (const struct sol_log_domain *domain, uint8_t message_level, const char *file, const char *function, int line, const char *format,...)
 Print out a message in a given domain and level. More...
 
static void sol_log_print_function_stderr (void *data, const struct sol_log_domain *domain, uint8_t message_level, const char *file, const char *function, int line, const char *format, va_list args)
 Standard logging function that send to standard error output. More...
 
static void sol_log_set_abort_level (uint8_t level)
 Set the logging level that should trigger the program to abort. More...
 
static void sol_log_set_level (uint8_t level)
 Set the global domain maximum level to level. More...
 
static void sol_log_set_print_function (void(*print)(void *data, const struct sol_log_domain *domain, uint8_t message_level, const char *file, const char *function, int line, const char *format, va_list args), const void *data)
 Set the function to print out log messages. More...
 
static void sol_log_set_show_colors (bool enabled)
 Enable/Disables the use of colors in logging messages. More...
 
static void sol_log_set_show_file (bool enabled)
 Enable/Disables the output of source file's name in logging messages. More...
 
static void sol_log_set_show_function (bool enabled)
 Enable/Disables the output of function's name containing the logging messages. More...
 
static void sol_log_set_show_line (bool enabled)
 Enable/Disables the output of the line number in logging messages. More...
 
static void sol_log_vprint (const struct sol_log_domain *domain, uint8_t message_level, const char *file, const char *function, int line, const char *format, va_list args)
 Similar to sol_log_print, but called with va_list instead of a variable number of arguments. More...
 

Variables

struct sol_log_domainsol_log_global_domain
 Global logging domain. More...
 

Detailed Description

Macro Definition Documentation

#define SOL_CRI (   fmt,
  ... 
)    SOL_LOG(SOL_LOG_LEVEL_CRITICAL, fmt, ## __VA_ARGS__)

Logs a message with critical level.

Logs a critical message to the SOL_LOG_DOMAIN using the given format message, as well as using current source file, line and function.

See Also
SOL_LOG(), SOL_ERR(), SOL_WRN(), SOL_INF() and SOL_DBG().
#define SOL_DBG (   fmt,
  ... 
)    SOL_LOG(SOL_LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__)

Logs a message with debug level.

Logs a debug message to the SOL_LOG_DOMAIN using the given format message, as well as using current source file, line and function.

See Also
SOL_LOG(), SOL_CRI(), SOL_ERR(), SOL_WRN() and SOL_INF().
Examples:
/src/samples/bluetooth/browse.c, /src/samples/mavlink/basic.c, and /src/samples/mavlink/goto.c.

Referenced by _sol_glib_integration_source_fd_handlers_adjust(), armed_cb(), on_error(), and sol_glib_integration().

#define SOL_ERR (   fmt,
  ... 
)    SOL_LOG(SOL_LOG_LEVEL_ERROR, fmt, ## __VA_ARGS__)

Logs a message with error level.

Logs an error message to the SOL_LOG_DOMAIN using the given format message, as well as using current source file, line and function.

See Also
SOL_LOG(), SOL_CRI(), SOL_WRN(), SOL_INF() and SOL_DBG().
Examples:
/src/samples/coap/oic-server.c, /src/samples/design_patterns/stream_sample.c, /src/samples/mavlink/basic.c, /src/samples/mavlink/goto.c, and /src/samples/mqtt/mqtt-subscribe.c.

Referenced by _inform_user(), main(), mavlink_connect_cb(), mission_reached_cb(), mode_changed_cb(), on_connect(), position_changed_cb(), and takeoff().

#define SOL_EXP_CHECK (   exp,
  ... 
)
Value:
do { \
if (SOL_UNLIKELY((exp))) { \
SOL_WRN("(%s) is true", # exp); \
return __VA_ARGS__; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Safety-check macro to check the expression exp.

This macro logs a warning message and returns if the expression exp is true.

Parameters
expSafety-check expression
...Optional return value
Examples:
/src/samples/design_patterns/stream_sample.c.

Referenced by my_stream_api_close(), and my_stream_api_feed().

#define SOL_EXP_CHECK_GOTO (   exp,
  label 
)
Value:
do { \
if (SOL_UNLIKELY((exp))) { \
SOL_WRN("(%s) is true", # exp); \
goto label; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Similar to SOL_EXP_CHECK but jumping to label instead of returning.

This macro logs a warning message and jumps to label if the expression exp is true.

Parameters
expSafety-check expression
labelgoto label
#define SOL_INF (   fmt,
  ... 
)    SOL_LOG(SOL_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__)
#define SOL_INT_CHECK (   var,
  exp,
  ... 
)    SOL_INT_CHECK_IMPL(var, exp, __VA_ARGS__)
#define SOL_INT_CHECK_ERRNO (   var,
  exp,
  err,
  ... 
)    SOL_INT_CHECK_IMPL_ERRNO(var, exp, err, __VA_ARGS__)

Safety-check macro to check if integer var against exp (and set errno).

This macro logs a warning message and returns if the integer var satisfies the expression exp. Additionally, it sets the errno variable to err.

Parameters
varInteger to be check
expSafety-check expression
errerrno value to set
...Optional return value
#define SOL_INT_CHECK_GOTO (   var,
  exp,
  label 
)    SOL_INT_CHECK_GOTO_IMPL(var, exp, label)
#define SOL_INT_CHECK_GOTO_ERRNO (   var,
  exp,
  err,
  label 
)    SOL_INT_CHECK_GOTO_IMPL_ERRNO(var, exp, label)

Similar to SOL_INT_CHECK but jumping to label instead of returning (and setting errno value).

This macro logs a warning message and jumps to label if the integer var satisfies the expression exp. Additionally, it sets the errno variable to err.

Parameters
varInteger to be check
expSafety-check expression
errerrno value to set
labelgoto label
#define SOL_LOG (   level,
  fmt,
  ... 
)
Value:
do { \
if (SOL_LOG_LEVEL_POSSIBLE(level)) { \
fmt, ## __VA_ARGS__); \
} \
} while (0)
static void sol_log_print(const struct sol_log_domain *domain, uint8_t message_level, const char *file, const char *function, int line, const char *format,...)
Print out a message in a given domain and level.
Definition: sol-log.h:738
#define SOL_LOG_FUNCTION
Macro defining what to log for function entries.
Definition: sol-log.h:586
#define SOL_LOG_LEVEL_POSSIBLE(level)
Check if log level is possible.
Definition: sol-log.h:552
#define SOL_LOG_DOMAIN
Defines the default log domain that is used by SOL_LOG(), SOL_CRI(), SOL_ERR(), SOL_WRN(), SOL_INF() and SOL_DBG().
Definition: sol-log.h:505
#define SOL_LOG_FILE
Macro defining what to log for file entries.
Definition: sol-log.h:569

Logs to SOL_LOG_DOMAIN using the given level and format message.

Also uses the current source file, line and function.

See Also
SOL_CRI(), SOL_ERR(), SOL_WRN(), SOL_INF() and SOL_DBG().
#define SOL_LOG_DOMAIN   sol_log_global_domain

Defines the default log domain that is used by SOL_LOG(), SOL_CRI(), SOL_ERR(), SOL_WRN(), SOL_INF() and SOL_DBG().

If not set prior to inclusion of sol-log.h, then sol_log_global_domain is used.

It can be used to provide custom log domains for nodes and modules.

#define SOL_LOG_FILE   ""

Macro defining what to log for file entries.

Set at build time. By default, it's set to FILE, i.e. the file name of the log call entry will be part of the log (and thus take part in the final Soletta binary/image). One can disable that behavior, though, when it'll be set to NULL (and no file name will take part in the log entries).

#define SOL_LOG_FUNCTION   ""

Macro defining what to log for function entries.

Set at build time. By default, it's set to PRETTY_FUNCTION, i.e. the function name of the log call entry will be part of the log (and thus take part in the final Soletta binary/image). One can disable that behavior, though, when it'll be set to NULL (and no function name will take part in the log entries).

#define SOL_LOG_LEVEL_INIT ( )

Sets the global log level based on the SOL_LOG_LEVEL macro.

Not to be used directly. Applications using SOL_MAIN_DEFAULT can be built passing -DSOL_LOG_LEVEL="level" on CFLAGS, in which case this macro will initialize the global log level to the value the macro is defined to.

#define SOL_LOG_LEVEL_MAXIMUM   -1

Ensures a maximum log level.

If defined, this level will be ensured before sol_log_print() is called by SOL_LOG(), SOL_CRI(), SOL_ERR(), SOL_WRN(), SOL_INF() and SOL_DBG(), which will avoid calling sol_log_print() at all and since it is comparing two constants the compiler will optimize out the block, effectively removing such code (and associated string) from the output binary.

One should check using SOL_LOG_LEVEL_POSSIBLE().

It only affects log levels in the library functions. If an application is using Soletta log system, it needs to be changed using application CFLAGS.

So to disable all log levels greater than warning on application build: CFLAGS += -DSOL_LOG_LEVEL_MAXIMUM=2

#define SOL_LOG_LEVEL_POSSIBLE (   level)    (0)

Check if log level is possible.

If SOL_LOG_LEVEL_MAXIMUM is set, it should be less or equal to it, otherwise it is always impossible.

#define SOL_LOG_LEVELS_INIT ( )

Sets the log level of the given log domains.

Not to be used directly. Applications using SOL_MAIN_DEFAULT can be built passing -DSOL_LOG_LEVELS="domain:level,..." on CFLAGS, in which case this macro will initialize each domain's log level to the values specified in the macro.

#define SOL_NULL_CHECK (   ptr,
  ... 
)
Value:
do { \
if (SOL_UNLIKELY(!(ptr))) { \
SOL_WRN("%s == NULL", # ptr); \
return __VA_ARGS__; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Convenience macro to check for NULL pointer.

This macro logs a warning message and returns if the pointer ptr happens to be NULL.

Parameters
ptrPointer to check
...Optional return value
Examples:
/src/samples/bluetooth/browse.c, /src/samples/bluetooth/connect-paired.c, /src/samples/bluetooth/heartbeat.c, /src/samples/coap/simple-server.c, /src/samples/design_patterns/stream_sample.c, /src/samples/http/server-sse.c, /src/samples/mqtt/mqtt-publish.c, and /src/samples/mqtt/mqtt-subscribe.c.

Referenced by _sol_glib_integration_on_source_fd(), _sol_glib_integration_source_fd_handlers_adjust(), enabled(), found_device(), my_stream_api_close(), my_stream_api_feed(), my_stream_api_new(), on_message(), publish_callback(), request_cb(), sol_efivars_write_string(), sol_fs_write_string(), sol_glib_integration(), sol_memmap_write_string(), startup(), timeout_cb(), and update_light().

#define SOL_NULL_CHECK_ERRNO (   ptr,
  err,
  ... 
)
Value:
do { \
if (SOL_UNLIKELY(!(ptr))) { \
SOL_WRN("%s == NULL", # ptr); \
errno = err; \
return __VA_ARGS__; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Convenience macro to check for NULL pointer (and set errno).

This macro logs a warning message and returns if the pointer ptr happens to be NULL. Additionally, it sets the errno variable to err.

Parameters
ptrPointer to check
errerrno value to set
...Optional return value
#define SOL_NULL_CHECK_GOTO (   ptr,
  label 
)
Value:
do { \
if (SOL_UNLIKELY(!(ptr))) { \
SOL_WRN("%s == NULL", # ptr); \
goto label; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Convenience macro to check for NULL pointer and jump to a given label.

This macro logs a warning message and jumps to label if the pointer ptr happens to be NULL.

Parameters
ptrPointer to check
labelgoto label
...Optional return value
Examples:
/src/samples/coap/oic-server.c, /src/samples/design_patterns/stream_sample.c, and /src/samples/iio+network/iio-gyroscope-console-and-mqtt-publish.c.

Referenced by _sol_glib_integration_source_fd_handlers_adjust(), _sol_glib_integration_source_prepare(), main(), my_stream_api_feed(), my_stream_api_new(), sol_efivars_write_string(), sol_fs_write_string(), sol_glib_integration(), sol_memmap_write_string(), and user_handle_get().

#define SOL_NULL_CHECK_MSG (   ptr,
  ret,
  fmt,
  ... 
)
Value:
do { \
if (SOL_UNLIKELY(!(ptr))) { \
SOL_WRN(fmt, ## __VA_ARGS__); \
return ret; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Similar to SOL_NULL_CHECK but allowing for a custom warning message.

Parameters
ptrPointer to check
retValue to return
fmtA standard 'printf()' format string
...The arguments for fmt
See Also
SOL_NULL_CHECK
#define SOL_NULL_CHECK_MSG_GOTO (   ptr,
  label,
  fmt,
  ... 
)
Value:
do { \
if (SOL_UNLIKELY(!(ptr))) { \
SOL_WRN(fmt, ## __VA_ARGS__); \
goto label; \
} \
} while (0)
#define SOL_WRN(fmt,...)
Logs a message with warning level.
Definition: sol-log.h:645
#define SOL_UNLIKELY(x)
Convenience macro for unlikely branch annotation.
Definition: sol-macros.h:201

Similar to SOL_NULL_CHECK_GOTO but allowing for a custom warning message.

Parameters
ptrPointer to check
labelgoto label
fmtA standard 'printf()' format string
...The arguments for fmt
See Also
SOL_NULL_CHECK_GOTO
#define SOL_WRN (   fmt,
  ... 
)    SOL_LOG(SOL_LOG_LEVEL_WARNING, fmt, ## __VA_ARGS__)

Typedef Documentation

Structure containing the attributes of the domain used for logging.

Enumeration Type Documentation

Available logging levels.

Levels are use to identify the severity of the issue related to a given log message.

Enumerator
SOL_LOG_LEVEL_CRITICAL 

Critical.

SOL_LOG_LEVEL_ERROR 

Error.

SOL_LOG_LEVEL_WARNING 

Warning.

SOL_LOG_LEVEL_INFO 

Informational.

SOL_LOG_LEVEL_DEBUG 

Debug.

Function Documentation

void sol_log_domain_init_level ( struct sol_log_domain domain)
inlinestatic

Initialize domain log level based on system configuration.

The system configuration may be environment variables like $SOL_LOG_LEVEL=NUMBER (or sol_log_set_level()) to apply for all or $SOL_LOG_LEVELS=<domain1_name>:<domain1_level>,<domainN_name>:<domainN_level> to give each domain its specific level.

Parameters
domainthe structure to fill level with system configuration value.
See Also
sol_log_set_level()
uint8_t sol_log_get_abort_level ( void  )
inlinestatic

Get the logging level that triggers the program to abort.

Returns
The logging level
uint8_t sol_log_get_level ( void  )
inlinestatic

Get the maximum log level allowed.

Returns
The logging level
const char * sol_log_get_level_color ( uint8_t  level)
inlinestatic

Get the color code used for the given logging level level.

Parameters
levelLogging level
Returns
Color code string
bool sol_log_get_show_colors ( void  )
inlinestatic

Get if color output is enabled or not.

Returns
true if enabled, false otherwise
bool sol_log_get_show_file ( void  )
inlinestatic

Get if showing source file's name is enabled or not.

Returns
true if enabled, false otherwise
bool sol_log_get_show_function ( void  )
inlinestatic

Get if showing function's name is enabled or not.

Returns
true if enabled, false otherwise
bool sol_log_get_show_line ( void  )
inlinestatic

Get if showing the line number is enabled or not.

Returns
true if enabled, false otherwise
void sol_log_level_to_str ( uint8_t  level,
char *  buf,
size_t  buflen 
)
inlinestatic

Convenience function to convert the logging level to string.

Parameters
levelLogging level
bufWhere to write the string
buflenBuffer size
void sol_log_print ( const struct sol_log_domain domain,
uint8_t  message_level,
const char *  file,
const char *  function,
int  line,
const char *  format,
  ... 
)
inlinestatic

Print out a message in a given domain and level.

This function will print out the given message only if the given domain's level is greater or equal to the message_level. Then it will call the current print function as set by sol_log_set_print_function(), which defaults to sol_log_print_function_stderr().

Some environment variables affect the behavior:

  • $SOL_LOG_ABORT=LEVEL if message_level is less or equal to LEVEL, then the program will abort execution with abort(3). Say $SOL_LOG_ABORT=ERROR, then it will abort on SOL_LOG_LEVEL_CRITICAL or SOL_LOG_LEVEL_ERROR.
  • $SOL_LOG_SHOW_COLORS=[0|1] will disable or enable the color output in functions that support it such as sol_log_print_function_stderr(). Defaults to enabled if terminal supports it.
  • $SOL_LOG_SHOW_FILE=[0|1] will disable or enable the file name in output. Enabled by default.
  • $SOL_LOG_SHOW_FUNCTION=[0|1] will disable or enable the function name in output. Enabled by default.
  • $SOL_LOG_SHOW_LINE=[0|1] will disable or enable the line number in output. Enabled by default.
Note
use the SOL_LOG(), SOL_CRI(), SOL_ERR(), SOL_WRN(), SOL_INF() or SOL_DBG() macros instead of this one, it should be easier to deal with.
Parameters
domainwhere the message belongs to.
message_levelthe level of the message such as SOL_LOG_LEVEL_ERROR.
filethe source file name that originated the message.
functionthe function that originated the message.
linethe source file line number that originated the message.
formatprintf(3) format string for the extra arguments. It does not need trailing "\n" as this will be enforced.
See Also
sol_log_set_level()
sol_log_set_abort_level()
static void sol_log_print_function_stderr ( void *  data,
const struct sol_log_domain domain,
uint8_t  message_level,
const char *  file,
const char *  function,
int  line,
const char *  format,
va_list  args 
)
inlinestatic

Standard logging function that send to standard error output.

This function must exist in every platform and is the default if no custom function is set.

See Also
sol_log_set_print_function()
void sol_log_set_abort_level ( uint8_t  level)
inlinestatic

Set the logging level that should trigger the program to abort.

Parameters
levelLogging level
void sol_log_set_level ( uint8_t  level)
inlinestatic

Set the global domain maximum level to level.

Parameters
levelLogging level
static void sol_log_set_print_function ( void(*)(void *data, const struct sol_log_domain *domain, uint8_t message_level, const char *file, const char *function, int line, const char *format, va_list args)  print,
const void *  data 
)
inlinestatic

Set the function to print out log messages.

The function will be called with sanitized values for domain, file, function, format.

The function is called with the first argument data being the same pointer given to this function as data parameter.

Note
The function is called with a lock held if threads are enabled. Then you should not trigger sol_log functions from inside it!
Parameters
printthe function to use to print out messages. If NULL, then sol_log_print_function_stderr() is used.
datathe context to give back to print when it is called.
void sol_log_set_show_colors ( bool  enabled)
inlinestatic

Enable/Disables the use of colors in logging messages.

Parameters
enabledEnables color if true, disables if false
void sol_log_set_show_file ( bool  enabled)
inlinestatic

Enable/Disables the output of source file's name in logging messages.

Parameters
enabledEnables file's name output if true, disables if false
void sol_log_set_show_function ( bool  enabled)
inlinestatic

Enable/Disables the output of function's name containing the logging messages.

Parameters
enabledEnables function's name output if true, disables if false
void sol_log_set_show_line ( bool  enabled)
inlinestatic

Enable/Disables the output of the line number in logging messages.

Parameters
enabledEnables line number output if true, disables if false
void sol_log_vprint ( const struct sol_log_domain domain,
uint8_t  message_level,
const char *  file,
const char *  function,
int  line,
const char *  format,
va_list  args 
)
inlinestatic

Similar to sol_log_print, but called with va_list instead of a variable number of arguments.

Parameters
domainwhere the message belongs to.
message_levelthe level of the message such as SOL_LOG_LEVEL_ERROR.
filethe source file name that originated the message.
functionthe function that originated the message.
linethe source file line number that originated the message.
formatprintf(3) format string for the extra arguments. It does not need trailing "\n" as this will be enforced.
argsVariables list.

Variable Documentation

struct sol_log_domain* sol_log_global_domain

Global logging domain.

Log domain is a way to provide a scope or category to messages that can be used for filtering in addition to log levels.