hnm_log()

Private helper function used to generate log messages.

Synopsis:

#include <hnm/core.h>
 
void hnm_log(int severity, const char *fmt,...)

Arguments:

severity
The severity of the condition that triggered the message. For more information on severity levels, see slogf() in the QNX C Library Reference. Valid values include:
  • _SLOG_INFO
  • _SLOG_WARN
  • _SLOG_ERROR
  • _SLOG_CRITICAL
fmt

The format string to print to the log buffer. This may include tokens that to be replaced by values of variable arguments appended to the end of the call. The max length of an expanded log message is 1024 characters (this includes all format substitutions and the null terminator).

Library:

libhnm

Description:

NOTE: The hnm_log() function is flagged "private" because using it directly is discouraged. Instead, use the macros that follow its declaration, which add debugging data when the DEBUG macro is defined. However, you may need to log at different verbosity levels for which macros haven't yet been defined, so this function may be useful in such cases.

The hnm_log() function sends debugging information with an associated severity to the appropriate log. The log where the data is actually sent is specified by the global variable log_stdout. If this variable is nonzero, output generated by this function is printed to the system log.

Log messages are written to the log buffer only if their severity is less than or equal to the current verbosity setting.

NOTE: If the severity of the log message is critical, the program is aborted. If the severity of the log message is _SLOG_ERROR, the program exits with a failure status.

Returns:

Nothing.