Log utilities¶
mm_log¶
#include <mmlog.h>
-
void
mm_log
(int lvl, const char* location, const char* msg, ...)¶ Add a formatted message to the log file
Parameters: - lvl (int) – log level.
- location (const char*) – origin of the log message.
- msg (const char*) – log message.
- ellipsis (ellipsis) – variable arguments
Description¶
Writes an entry in the log following the suggested format by the mmlib
standard: date, time, origin, level, message. The origin part is specified
by the location
parameter. The severity part is defined by the lvl
parameter which must one of this value listed from the most critical to the
least one¶
MM_LOG_FATAL MM_LOG_ERROR MM_LOG_WARN MM_LOG_INFO MM_LOG_DEBUG
The message part of log entry is formed according the format specified by the
msg
parameters which convert the formatting and conversion of the optional
argument list of the function. As the format specified by msg
follows the
one of the sprintf
function.
If the parameter lvl is less critical than the environment variable
MM_LOG_MAXLEVEL
, the log entry will not be written to log and simply
ignored.
Usually, users do not call mm_log()
directly but use one of the following
macros: mm_log_fatal()
, mm_log_error()
, mm_log_warn()
, mm_log_info()
,
mm_log_debug()
Return¶
None
ENVIRONMENT: You can control the output on the log at runtime using the
environment variable MM_LOG_MAXLEVEL
. It specifies the maximum level of
severity that must be written on the log. It must be set to one of these
values¶
NONE FATAL ERROR WARN INFO DEBUG
A value different from the one listed above, the maximum level output on the log is WARN.
mm_log()
is thread-safe.
See also¶
sprintf()
, mm_log_fatal()
, mm_log_error()
, mm_log_warn()
,
mm_log_info()
, mm_log_debug()