35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
#ifndef PTK_PTK_LOG_H_
|
|
#define PTK_PTK_LOG_H_
|
|
|
|
#include <limits.h>
|
|
#include <stdarg.h>
|
|
|
|
typedef enum {
|
|
PTK_LOG_LEVEL_OFF = 0,
|
|
PTK_LOG_LEVEL_ERR = 1,
|
|
PTK_LOG_LEVEL_WARN = 2,
|
|
PTK_LOG_LEVEL_INFO = 3,
|
|
PTK_LOG_LEVEL_DEBUG = 4,
|
|
PTK_LOG_LEVEL_TRACE = 5,
|
|
PTK_LOG_LEVEL_ALL = INT_MAX,
|
|
} PtkLogLevel;
|
|
|
|
void ptk_log_init(const PtkLogLevel level);
|
|
|
|
void ptk_log(const char *file, const int line, const PtkLogLevel level, const char *fmt, ...);
|
|
|
|
void ptk_err (const char *file, const int line, const char *fmt, ...);
|
|
void ptk_warn (const char *file, const int line, const char *fmt, ...);
|
|
void ptk_info (const char *file, const int line, const char *fmt, ...);
|
|
void ptk_debug(const char *file, const int line, const char *fmt, ...);
|
|
void ptk_trace(const char *file, const int line, const char *fmt, ...);
|
|
|
|
#define PTK_LOG(level, ...) ptk_log(__FILE__, __LINE__, level, __VA_ARGS__)
|
|
|
|
#define PTK_ERR(...) ptk_err(__FILE__, __LINE__, __VA_ARGS__)
|
|
#define PTK_WARN(...) ptk_warn(__FILE__, __LINE__, __VA_ARGS__)
|
|
#define PTK_INFO(...) ptk_info(__FILE__, __LINE__, __VA_ARGS__)
|
|
#define PTK_DEBUG(...) ptk_debug(__FILE__, __LINE__, __VA_ARGS__)
|
|
#define PTK_TRACE(...) ptk_trace(__FILE__, __LINE__, __VA_ARGS__)
|
|
|
|
#endif // PTK_PTK_LOG_H_
|