NNG_LOG(3)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

🌸 NAME 🌸

nng_log β€” posting messages into your logs, no cap πŸ’Œ


✨ 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 πŸ’–

Okay so bestie, these functions are literally your lil messenger service 🫢 β€” you use them to post a message to system or application logs. That's the whole vibe.

The first five forms all post a message at the severity indicated by the function name, periodt. So like, nng_log_err is giving major red-flag energy, nng_log_debug is your chill lil whisper, you get it πŸ’…

The msgid should be a short message identifier, and it should indicate the message in question. And guess what β€” a NULL value for msgid can be used as well. Iconic, flexible, we love that for you ✨

πŸŽ€ message identifiers (the msgid situation)

Message identifiers can be used to assist in filtering logs. They should uniquely identify the nature of the problem, where possible, to assist in trouble-shooting. Keep them short too β€” eight characters or less is ideal, and more than sixteen is strongly discouraged. Not me begging you to keep your msgids cute and tiny πŸ™ˆ

⭐ the formatting

The message is formatted as if by sprintf, using msg as the format, and the remaining arguments as arguments to the format. Classic. Standard. Slays. πŸ’…

πŸ” nng_log_auth

The final function, nng_log_auth, is used for posting authentication related messages, which might be treated specially β€” such as by 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

🌈 where do the messages even go tho

The message itself is handled according to the logging facility set up with nng_log_set_logger.

⚠️ Heads up bestie: message delivery is best effort, and messages may be suppressed based on the priority set with nng_log_set_level. So like... don't be shocked if your lil message ghosted you 😭
πŸ’€ And this one is important: 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. Yeah. It just throws your lil message into the void and walks away. Fr fr. Set a logger, or you're screaming into the abyss πŸ•³οΈβœ¨

πŸ‘€ SEE ALSO πŸ‘€


k bye ily, this page is brought to you by the NNG Reference Manual, dated 2026-06-30, and yes the page you're on rn is NNG_LOG(3) β€” stay logged, stay slaying πŸ’–πŸ¦‹

πŸ“¦ where this page comes from