mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
log: add LOG_ERRNO()
Works like LOG_ERR(), but appends a string representation of the current errno value to the log message string.
This commit is contained in:
parent
8897e480c5
commit
7f2c0681a7
2 changed files with 22 additions and 2 deletions
4
log.h
4
log.h
|
@ -5,11 +5,15 @@ enum log_class { LOG_CLASS_ERROR, LOG_CLASS_WARNING, LOG_CLASS_INFO, LOG_CLASS_D
|
|||
void log_msg(enum log_class log_class, const char *module,
|
||||
const char *file, int lineno,
|
||||
const char *fmt, ...) __attribute__((format (printf, 5, 6)));
|
||||
|
||||
void log_errno(enum log_class log_class, const char *module,
|
||||
const char *file, int lineno,
|
||||
const char *fmt, ...) __attribute__((format (printf, 5, 6)));
|
||||
|
||||
#define LOG_ERR(fmt, ...) \
|
||||
log_msg(LOG_CLASS_ERROR, LOG_MODULE, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
#define LOG_ERRNO(fmt, ...) \
|
||||
log_errno(LOG_CLASS_ERROR, LOG_MODULE, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
#define LOG_WARN(fmt, ...) \
|
||||
log_msg(LOG_CLASS_WARNING, LOG_MODULE, __FILE__, __LINE__, fmt, ## __VA_ARGS__)
|
||||
#define LOG_INFO(fmt, ...) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue