These functions and data types are responsible for logging the SML events.
More...
|
#define | sml_critical(...) sml_log_print(SML_LOG_LEVEL_CRITICAL, __VA_ARGS__) |
| Syntactic sugar to sml_log_print(SML_LOG_LEVEL_CRITICAL, "critical message") More...
|
|
#define | sml_debug(...) sml_log_print(SML_LOG_LEVEL_DEBUG, __VA_ARGS__) |
| Syntactic sugar to sml_log_print(SML_LOG_LEVEL_DEBUG, "debug message") More...
|
|
#define | sml_error(...) sml_log_print(SML_LOG_LEVEL_ERROR, __VA_ARGS__) |
| Syntactic sugar to sml_log_print(SML_LOG_LEVEL_ERROR, "error message") More...
|
|
#define | sml_info(...) sml_log_print(SML_LOG_LEVEL_INFO, __VA_ARGS__) |
| Syntactic sugar to sml_log_print(SML_LOG_LEVEL_INFO, "info message") More...
|
|
#define | sml_warning(...) sml_log_print(SML_LOG_LEVEL_WARNING, __VA_ARGS__) |
| Syntactic sugar to sml_log_print(SML_LOG_LEVEL_WARNING, "warning message") More...
|
|
These functions and data types are responsible for logging the SML events.
typedef void(* sml_log_handler_cb)(enum sml_log_level level, const char *msg, void *data) |
Log level types.
Enumerator |
---|
SML_LOG_LEVEL_DEBUG |
Show debug messages. The debug messages will not be logged with SML is compiled in Release mode.
|
SML_LOG_LEVEL_INFO |
Show info messages.
|
SML_LOG_LEVEL_WARNING |
Show warning messages.
|
SML_LOG_LEVEL_ERROR |
Show error messages.
|
SML_LOG_LEVEL_CRITICAL |
Show critical messages.
|
SML_LOG_LEVEL_ALL |
Show all messages.
|
void sml_log_print |
( |
enum sml_log_level |
level, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Prints a message with a desired log level.
- Parameters
-
level | The desired log level. |
format | A formatted string. |
... | Contents of the formatted string. |
Set a log handler.
This function is useful if one wants to log SML events in files or do not want to log SML_LOG_LEVEL_WARNING messages, for example. SML provides a default sml_log_handler_cb that is automatically set at startup, the log level is set to SML_LOG_LEVEL_ALL and all messages will be logged at stdout.
- Parameters
-
levels | The log levels that will be captured. |
cb | A user defined callback to a log handler. |
data | User data to cb. |
- See Also
- sml_log_handler_cb