Log utility module interface header file. More...
Go to the source code of this file.
Typedefs | |
typedef void(* | mcl_log_util_callback_t) (int log_level, const char *tag, const char *message, void *user_context) |
Log util callback function definition. More... | |
Enumerations | |
enum | E_LOG_OUTPUT { E_LOG_OUTPUT_FILE, E_LOG_OUTPUT_CALLBACK, E_LOG_OUTPUT_SYSLOG, E_LOG_OUTPUT_STDERR, E_LOG_OUTPUT_NULL } |
MCL Log output definitions. More... | |
Functions | |
MCL_EXPORT E_MCL_ERROR_CODE | mcl_log_util_set_output_level (const int log_level) |
Sets the global output level. The output level is used during runtime check. No logs are written if given log level is less than this output level. More... | |
MCL_EXPORT E_MCL_ERROR_CODE | mcl_log_util_initialize (E_LOG_OUTPUT log_output,...) |
This function initializes logging where output channel is set and configured via variable arguments. More... | |
MCL_EXPORT void | mcl_log_util_finalize (void) |
Performs finalizing operations for logging. More... | |
MCL_EXPORT const char * | mcl_log_util_convert_error_code_to_string (E_MCL_ERROR_CODE error_code) |
This function converts the given error code to its string value. More... | |
Log utility module interface header file.
Definition in file mcl_log_util.h.
typedef void(* mcl_log_util_callback_t) (int log_level, const char *tag, const char *message, void *user_context) |
Log util callback function definition.
User's callback can be used with mcl_log_util_callback_t. Given parameters are log_level:
Log level of the message, tag:
Associated tag, message:
The log message formatted as : Timestamp | PID | Thread ID | Level | Tag | module.function | line | message and user_context:
User's own context.
Definition at line 46 of file mcl_log_util.h.
enum E_LOG_OUTPUT |
MCL Log output definitions.
Definition at line 30 of file mcl_log_util.h.
MCL_EXPORT const char* mcl_log_util_convert_error_code_to_string | ( | E_MCL_ERROR_CODE | error_code | ) |
This function converts the given error code to its string value.
[in] | error_code | Error code to convert to string. |
error_code
is invalid. It should not be freed, because its owner is MCL. Definition at line 250 of file log_util.c.
References DEBUG_ENTRY, DEBUG_LEAVE, error_code_strings, MCL_ERROR, MCL_ERROR_CODE_END, MCL_NULL, and MCL_OK.
MCL_EXPORT void mcl_log_util_finalize | ( | void | ) |
Performs finalizing operations for logging.
syslog
has been initialized, this function must be called in order to close output to syslog
. Definition at line 230 of file log_util.c.
References E_LOG_OUTPUT_CALLBACK, E_LOG_OUTPUT_FILE, E_LOG_OUTPUT_NULL, E_LOG_OUTPUT_SYSLOG, file_util_fclose_without_log(), log_file, log_output_global, MCL_NULL, and user_callback.
MCL_EXPORT E_MCL_ERROR_CODE mcl_log_util_initialize | ( | E_LOG_OUTPUT | log_output, |
... | |||
) |
This function initializes logging where output channel is set and configured via variable arguments.
Output channel and related variable arguments are as following:
log_output
= E_LOG_OUTPUT_FILE, second argument has to be the file name. log_output
= E_LOG_OUTPUT_CALLBACK, second argument is mcl_log_util_callback_t and third argument is void *user_context log_output
= E_LOG_OUTPUT_SYSLOG, no additional argument is required. log_output
= E_LOG_OUTPUT_STDERR, no additional argument is required. After initialization any log messages are printed to the chosen output channel.
[in] | log_output | Selects the desired output channel. |
Definition at line 185 of file log_util.c.
References E_LOG_OUTPUT_CALLBACK, E_LOG_OUTPUT_FILE, E_LOG_OUTPUT_SYSLOG, file_util_fopen_without_log(), log_file, log_output_global, log_util_default_callback(), LOG_UTIL_MCL_SYSLOG, MCL_FILE_CANNOT_BE_OPENED, MCL_INVALID_PARAMETER, MCL_NULL, MCL_OK, and user_callback.
MCL_EXPORT E_MCL_ERROR_CODE mcl_log_util_set_output_level | ( | const int | log_level | ) |
Sets the global output level. The output level is used during runtime check. No logs are written if given log level is less than this output level.
[in] | log_level | The output level to set with. Following log levels can be set.
|
Definition at line 174 of file log_util.c.
References LOG_UTIL_LEVEL_FATAL, LOG_UTIL_LEVEL_NONE, LOG_UTIL_LEVEL_VERBOSE, MCL_INVALID_LOG_LEVEL, and MCL_OK.