diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-08-30 17:01:28 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-08-30 17:01:28 +0300 |
commit | e1ceef73192f0300ff9b10ba9a16475fbebeaa5f (patch) | |
tree | 0cb2bc5336a522b965c1d171b433044591721e20 /src/common.h | |
parent | de3a062bfc206bf0373f96f4f6cc8c74ffcbab48 (diff) |
proper repl, stylistic changes, removed trailing whitespace
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common.h b/src/common.h index b91459a..225f217 100644 --- a/src/common.h +++ b/src/common.h @@ -11,8 +11,15 @@ #define _YELLOW "\033[0;33m" #define _RST "\033[0m" -#define _log_print(...) fprintf(stdout, __VA_ARGS__) +#define _log_print(...) fprintf(stderr, __VA_ARGS__) + +#ifdef DEBUG #define _log(color, message) _log_print("[%s] %s%-7s"_RST" ", timenow(), color, message) +#define _log_file() _log_print(__FILE__":%d: ", __LINE__) +#else +#define _log(color, message) _log_print("%s%-7s"_RST" ", color, message) +#define _log_file() +#endif #define info(...) do { \ _log(_GREEN, "[INFO]"); \ @@ -20,7 +27,7 @@ } while(0) #define err(...) do { \ _log(_RED, "[ERROR]"); \ - _log_print(__FILE__":%d: ", __LINE__); \ + _log_file(); \ _log_print(__VA_ARGS__); _log_print("\n"); \ } while(0) #define die(...) do { \ @@ -95,4 +102,3 @@ DIE_ALLOC_BUILDER(realloc, (void *ptr, size_t size), (ptr, size)) // #endif #endif - |