NNG_LOG(3)

NAME
nng_log - log messages

SYNOPSIS

    #include <nng/nng.h>

    void nng_log_err(const char *msgid, const char *msg, ...);
    void nng_log_warn(const char *msgid, const char *msg, ...);
    void nng_log_notice(const char *msgid, const char *msg, ...);
    void nng_log_info(const char *msgid, const char *msg, ...);
    void nng_log_debug(const char *msgid, const char *msg, ...);

    void nng_log_auth(nng_log_level level, const char *msgid, const char *msg, ...);

DESCRIPTION

These functions are used to post a message to system or application logs.

The first five forms all post a message at the severity indicated by the function name. The msgid should be a short message identifier that should indicate the message in question. A NULL value for msgid canbe used as well.

Message identifiers can be used to assist in filtering logs. These should uniquely identify the nature of the problem, whe possible, to assist in trouble-shooting. They should also be short. Eight characters or less is ideal, and more than sixteen is strongly discouraged.

The message is formatting as if by sprintf, using msg as the format, and remaining arguments as arguments to the format.

The final function, nng_log_auth, is used for posting authentication related messages which might be treated specially, such as be storing them in a separate secured log file. It takes the severity as a level in level. The severity can be one of the following values:

    • NNG_LOG_ERR

    • NNG_LOG_WARN

    • NNG_LOG_NOTICE

    • NNG_LOG_INFO

    • NNG_LOG_DEBUG

The message itself is handled according to the logging facility set up with nng_log_set_logger. Message delivery is best effort, and messages may be suppressed based on the priority set with nng_log_set_level.

Note that in order to get log messages, a suitable logger must be set using nng_log_set_logger. The default logger, nng_null_logger simply discards logged content.

SEE ALSO

nng_log_set_facility(3), nng_log_set_level(3), nng_log_set_logger(3)