2021-11-30 21:29:18 -06:00
|
|
|
#ifndef LOG_H
|
|
|
|
#define LOG_H
|
|
|
|
|
2022-11-24 01:54:17 -06:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2023-03-10 13:13:48 -06:00
|
|
|
#define ERROR_BUFFER 1024*1024
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#define LOG_INFO 0
|
|
|
|
#define LOG_WARN 1
|
|
|
|
#define LOG_ERROR 2
|
|
|
|
#define LOG_CRITICAL 3
|
|
|
|
|
2023-03-24 14:01:01 -05:00
|
|
|
#define M_PI 3.14
|
|
|
|
|
2022-12-19 12:16:51 -06:00
|
|
|
extern char lastlog[];
|
2023-03-17 10:25:35 -05:00
|
|
|
extern char consolelog[];
|
2023-04-24 17:22:18 -05:00
|
|
|
extern int logLevel;
|
2022-12-19 12:16:51 -06:00
|
|
|
|
2022-12-23 13:48:29 -06:00
|
|
|
#if DBG
|
2022-11-18 12:03:07 -06:00
|
|
|
#define YughLog(cat, pri, msg, ...) mYughLog(cat, pri, __LINE__, __FILE__, msg, ##__VA_ARGS__)
|
|
|
|
#define YughInfo(msg, ...) mYughLog(0, 0, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughWarn(msg, ...) mYughLog(0, 1, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughError(msg, ...) mYughLog(0, 2, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughCritical(msg, ...) mYughLog(0, 3, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
2022-12-23 13:48:29 -06:00
|
|
|
#else
|
|
|
|
#define YughLog(cat, pri, msg, ...)
|
|
|
|
#define YughInfo(msg, ...)
|
|
|
|
#define YughWarn(msg, ...)
|
|
|
|
#define YughError(msg, ...)
|
|
|
|
#define YughCritical(msg, ...)
|
|
|
|
#endif
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
void mYughLog(int category, int priority, int line, const char *file, const char *message, ...);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-11-24 01:54:17 -06:00
|
|
|
void log_setfile(char *file);
|
|
|
|
void log_cat(FILE *f);
|
2023-04-24 17:22:18 -05:00
|
|
|
void log_print(const char *str);
|
2022-11-24 01:54:17 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#endif
|