diff options
| author | 0scar <qgt268@alumni.ku.dk> | 2020-09-29 06:51:02 +0000 |
|---|---|---|
| committer | 0scar <qgt268@alumni.ku.dk> | 2023-07-28 09:48:17 +0000 |
| commit | 6c16f339224a4736f4ed57d15bb3e5f968a635ab (patch) | |
| tree | ab13afea4b6f9acfb4a139a3125f265c90bc9d80 /include/engine/logging.h | |
Initial independent commit
Diffstat (limited to 'include/engine/logging.h')
| -rw-r--r-- | include/engine/logging.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/engine/logging.h b/include/engine/logging.h new file mode 100644 index 0000000..1365a5b --- /dev/null +++ b/include/engine/logging.h @@ -0,0 +1,44 @@ +#ifndef LOGGING_H +#define LOGGING_H + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <math.h> + +#include "types.h" + +#if defined __linux__ || defined __APPLE__ +#define TERM_COLOR_RESET "\033[0m" +#define TERM_COLOR_RED "\033[31m" +#define TERM_COLOR_GREEN "\033[32m" +#define TERM_COLOR_YELLOW "\033[33m" +#define TERM_COLOR_BLUE "\033[34m" +#define TERM_COLOR_PURPLE "\033[35m" +#else +#define TERM_COLOR_RESET +#define TERM_COLOR_RED +#define TERM_COLOR_GREEN +#define TERM_COLOR_YELLOW +#define TERM_COLOR_BLUE +#define TERM_COLOR_PURPLE +#endif + +#define STR(a) (#a) + +void _log(FILE *stream, const char *prefix, const char *fmt, va_list ap); + +void LOG(const char *fmt, ...); + +void INFO_(const char *fmt, ...); +void INFO(const char *fmt, ...); + +#define _DEBUG(...) __DEBUG(__FILE__,__LINE__, __func__, __VA_ARGS__) +void __DEBUG(const char* file, const i32 line, const char* func, const char *fmt, ...); + +void WARN(const char *fmt, ...); + +void ERROR(const char *fmt, ...); + +#endif |
