logs.c

Implements logging functions.

  • Author: Edward Jones
  • Date: 2021-09-17

Source file

LOG_X_CALL

Construct a call to the logging function at verbosity lvl, where v is the start of the formatting.

  • Param lvl: Verbosity level of the call
  • Param v: Name of the first format argument

Returns: A call to log_x with va_args handled

#define LOG_X_CALL(name, f)                                                                                            \

log_debug

Write a debug message to stderr.

  • Param format: debug message format (printf)
  • Param ...: Possible printf arguments
void log_debug(const char* restrict format, ...) { LOG_X_CALL(debug, format); }

log_err

Write an error stderr.

  • Param format: Error format (printf)
  • Param ...: Possible printf arguments
void log_err(const char* restrict format, ...) { LOG_X_CALL(err, format); }

log_info

Write information to stderr.

  • Param format: Information format (printf)
  • Param ...: Possible printf arguments
void log_info(const char* restrict format, ...) { LOG_X_CALL(info, format); }

log_warn

Write a warning to stderr.

  • Param format: Warning format (printf)
  • Param ...: Possible printf arguments
int log_warn(const char* restrict format, ...)