mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
log: initial framework for logging things
This commit is contained in:
parent
c1e71eca60
commit
d516ffdda0
3 changed files with 62 additions and 0 deletions
16
log.h
Normal file
16
log.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
enum log_class { LOG_CLASS_ERROR, LOG_CLASS_WARNING, LOG_CLASS_INFO, LOG_CLASS_DEBUG };
|
||||
|
||||
void log_class(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_class(LOG_CLASS_ERROR, LOG_MODULE, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
||||
#define LOG_WARN(fmt, ...) \
|
||||
log_class(LOG_CLASS_WARNING, LOG_MODULE, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
||||
#define LOG_INFO(fmt, ...) \
|
||||
log_class(LOG_CLASS_INFO, LOG_MODULE, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
||||
#define LOG_DBG(fmt, ...) \
|
||||
log_class(LOG_CLASS_DEBUG, LOG_MODULE, __FILE__, __LINE__, fmt, __VA_ARGS__)
|
Loading…
Add table
Add a link
Reference in a new issue