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-09-02 06:53:52 -05:00
|
|
|
#include <stdint.h>
|
2022-11-24 01:54:17 -06:00
|
|
|
|
2024-03-13 16:30:55 -05:00
|
|
|
#define LOG_SPAM 0
|
|
|
|
#define LOG_DEBUG 1
|
|
|
|
#define LOG_INFO 2
|
|
|
|
#define LOG_WARN 3
|
|
|
|
#define LOG_ERROR 4
|
2024-03-14 09:33:15 -05:00
|
|
|
#define LOG_PANIC 5
|
2022-02-06 10:14:57 -06:00
|
|
|
|
2023-05-27 10:13:20 -05:00
|
|
|
#define LOG_ENGINE 0
|
|
|
|
#define LOG_SCRIPT 1
|
|
|
|
#define LOG_RENDER 2
|
|
|
|
|
2023-09-13 07:31:00 -05:00
|
|
|
void log_init();
|
2024-03-14 09:33:15 -05:00
|
|
|
void log_shutdown();
|
2023-09-13 07:31:00 -05:00
|
|
|
|
2024-03-14 14:10:06 -05:00
|
|
|
extern int stdout_lvl;
|
|
|
|
|
2023-09-03 12:50:02 -05:00
|
|
|
#ifndef NDEBUG
|
2022-11-18 12:03:07 -06:00
|
|
|
#define YughLog(cat, pri, msg, ...) mYughLog(cat, pri, __LINE__, __FILE__, msg, ##__VA_ARGS__)
|
2024-03-14 09:33:15 -05:00
|
|
|
#define YughSpam(msg, ...) mYughLog(0, LOG_SPAM, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughInfo(msg, ...) mYughLog(0, LOG_INFO, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughWarn(msg, ...) mYughLog(0, LOG_WARN, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughError(msg, ...) mYughLog(0, LOG_ERROR, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
|
|
|
#define YughCritical(msg, ...) mYughLog(0, LOG_PANIC, __LINE__, __FILE__, msg, ##__VA_ARGS__);
|
2022-12-23 13:48:29 -06:00
|
|
|
#else
|
|
|
|
#define YughLog(cat, pri, msg, ...)
|
2024-03-19 14:39:19 -05:00
|
|
|
#define YughSpam(msg,...)
|
2022-12-23 13:48:29 -06:00
|
|
|
#define YughInfo(msg, ...)
|
|
|
|
#define YughWarn(msg, ...)
|
|
|
|
#define YughError(msg, ...)
|
|
|
|
#define YughCritical(msg, ...)
|
|
|
|
#endif
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2024-03-14 09:33:15 -05:00
|
|
|
/* These log to the correct areas */
|
2022-02-06 10:14:57 -06:00
|
|
|
void mYughLog(int category, int priority, int line, const char *file, const char *message, ...);
|
2023-09-02 06:53:52 -05:00
|
|
|
void sg_logging(const char *tag, uint32_t lvl, uint32_t id, const char *msg, uint32_t line, const char *file, void *data);
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2023-04-24 17:22:18 -05:00
|
|
|
void log_print(const char *str);
|
2024-08-24 18:46:21 -05:00
|
|
|
void term_print(const char *str);
|
2022-11-24 01:54:17 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#endif
|