diff options
author | turret <turret@duck.com> | 2023-12-18 14:02:29 -0600 |
---|---|---|
committer | turret <turret@duck.com> | 2023-12-18 14:02:29 -0600 |
commit | 4b8125ad754d87f44bdae933bd33ff0305cfa9ea (patch) | |
tree | 2dd584e8854fc3644fa4e765329844ad9e1448ab /include/log.h | |
parent | c582ecb341ba81a7ee7976b44df5a37caa3226c1 (diff) | |
download | discord-bot-skeleton-4b8125ad754d87f44bdae933bd33ff0305cfa9ea.tar.gz discord-bot-skeleton-4b8125ad754d87f44bdae933bd33ff0305cfa9ea.tar.bz2 discord-bot-skeleton-4b8125ad754d87f44bdae933bd33ff0305cfa9ea.zip |
log: add panic feat
rearrange print to use internal vaprint to accomadate print
added additional options to vaprint (nolock, noparsecolon, etc)
use subsystem modes to accomadate restarting
Diffstat (limited to 'include/log.h')
-rw-r--r-- | include/log.h | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/include/log.h b/include/log.h index 397ce2b..85f192d 100644 --- a/include/log.h +++ b/include/log.h @@ -1,4 +1,3 @@ - #define LOG_SOH "\001" #define LOG_SOH_ASCII '\001' @@ -14,19 +13,33 @@ #define DEFAULT_LOGLEVEL NOTICE_LOGLEVEL #define CONSOLE_LOGLEVEL DEBUG_LOGLEVEL -#define LOG_EMERG LOG_SOH "0" -#define LOG_ALERT LOG_SOH "1" -#define LOG_CRIT LOG_SOH "2" -#define LOG_ERR LOG_SOH "3" -#define LOG_WARNING LOG_SOH "4" -#define LOG_NOTICE LOG_SOH "5" -#define LOG_INFO LOG_SOH "6" -#define LOG_DEBUG LOG_SOH "7" +#define LOG_EMERG LOG_SOH "\1" "0" +#define LOG_ALERT LOG_SOH "\1" "1" +#define LOG_CRIT LOG_SOH "\1" "2" +#define LOG_ERR LOG_SOH "\1" "3" +#define LOG_WARNING LOG_SOH "\1" "4" +#define LOG_NOTICE LOG_SOH "\1" "5" +#define LOG_INFO LOG_SOH "\1" "6" +#define LOG_DEBUG LOG_SOH "\1" "7" #define LOG_DEFAULT "" int print(const char *fmt, ...); +#define PANICMODE_DEBUGONLY 'o' +#define PANICMODE_RESPAWN 'r' +#define PANICMODE_DIE 'd' + +#define PANIC_OOPS LOG_SOH #PANICMODE_DEBUGONLY +#define PANIC_RESPAWN LOG_SOH #PANICMODE_RESPAWN +#define PANIC_PANIC LOG_SOH #PANICMODE_DIE + +#define PANIC_DEFAULT PANIC_PANIC + +void _panic(const char *fileorigin, const int lineorigin, const char *fmt, ...); +#define panic(...) _panic(__FILE__, __LINE__, __VA_ARGS__) +#define oops(...) _panic(__FILE__, __LINE__, PANIC_OOPS __VA_ARGS__) + #define ANSI_CSI "\x1b[" #define ANSI_BOLD ANSI_CSI "1m" |