diff options
| author | Enrique | 2025-01-06 00:50:11 +0100 |
|---|---|---|
| committer | Enrique | 2025-01-06 00:50:11 +0100 |
| commit | 789169d70d24ff2c1c9804f0149d0508de6dfcfa (patch) | |
| tree | 088ec2ce664a13aeeb3603d0eee6c737caff7190 /log/log.h | |
| download | soikk-libs-789169d70d24ff2c1c9804f0149d0508de6dfcfa.tar.xz soikk-libs-789169d70d24ff2c1c9804f0149d0508de6dfcfa.tar.zst | |
First upload
Diffstat (limited to 'log/log.h')
| -rwxr-xr-x | log/log.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/log/log.h b/log/log.h new file mode 100755 index 0000000..09b93bb --- /dev/null +++ b/log/log.h @@ -0,0 +1,41 @@ +#ifndef LOG_H +#define LOG_H + +#define PID +#define COLOR + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <stdarg.h> +#ifdef PID +#include <unistd.h> +#endif + + +enum { + LOG_DEBUG, + LOG_INFO, + LOG_WARN, + LOG_ERROR, + LOG_LEVEL_COUNT +}; + +#define MAX_LOGFILES (8) +#define MSG_LIMIT (256) + + +int log_set_stderr(int level, int of); +void log_set_level(int level, int of); +int log_add_fp(int level, FILE *fp); +void log_time_format(char *tf); +int log_nanoseconds(int n); +void log_message(int level, char *file, int line, char *fmt, ...); + +#define log_debug(...) log_message(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__) +#define log_info(...) log_message(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__) +#define log_warn(...) log_message(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__) +#define log_error(...) log_message(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__) + +#endif |
