diff options
| author | Federico Angelilli <code@fedang.net> | 2023-11-17 15:42:49 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2023-11-17 15:42:49 +0100 |
| commit | ab92cac18652f72be12f68b5a96095ba8eb5afdf (patch) | |
| tree | e52a5f295c7cda59e67a341fa87d25983bd56745 /src/log.h | |
| parent | f8363e89257e8b0a4ff71accbd7b6be22935274f (diff) | |
Reorganize project structure
Diffstat (limited to 'src/log.h')
| -rw-r--r-- | src/log.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/log.h b/src/log.h new file mode 100644 index 0000000..c96536b --- /dev/null +++ b/src/log.h @@ -0,0 +1,27 @@ +#ifndef COMET_LOG_H +#define COMET_LOG_H + +#include <glib.h> + +#define DEBUG_FORMAT(format, ...) \ + "[%s] \x1b[1mdebug\x1b[0m: " format, __func__, ## __VA_ARGS__ + +#define INFO_FORMAT(format, ...) \ + "[%s] \x1b[1;96minfo\x1b[0m: " format, __func__, ## __VA_ARGS__ + +#define WARNING_FORMAT(format, ...) \ + "[%s] \x1b[1;33mwarning\x1b[0m: " format, __func__, ## __VA_ARGS__ + +#define ERROR_FORMAT(format, ...) \ + "[%s] \x1b[1;31merror\x1b[0m: " format, __func__, ## __VA_ARGS__ + +#define log_debug(...) g_debug(DEBUG_FORMAT(__VA_ARGS__)) +#define log_info(...) g_info(INFO_FORMAT(__VA_ARGS__)) +#define log_warning(...) g_warning(WARNING_FORMAT(__VA_ARGS__)) +#define log_error(...) g_error(ERROR_FORMAT(__VA_ARGS__)) + +void log_init(GLogLevelFlags level); + +#endif + +// vim: ts=4 sw=4 et |
