logmsg()

Helper function used to generate log messages.

Synopsis:

#include "asr/protos.h"
 
int logmsg(int severity, const char *fmt,...) __attribute__((format(printf

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 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:

libasr

Description:

The logmsg() 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:

0 on success.

-1 on error.