diff options
author | sanine <sanine.not@pm.me> | 2022-06-14 00:05:58 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-06-14 00:05:58 -0500 |
commit | 034d5c965ff34cfdf4b153af9f32360a02e35684 (patch) | |
tree | fcbe5ca527d76a303c197ea8308c6e488ef7c0b4 /src/logging/logging.c | |
parent | 8fb7916a0d0cb007a4c3a4e6a31af58765268ca3 (diff) |
scorched earth, start over
Diffstat (limited to 'src/logging/logging.c')
-rw-r--r-- | src/logging/logging.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/logging/logging.c b/src/logging/logging.c deleted file mode 100644 index 2a63a77..0000000 --- a/src/logging/logging.c +++ /dev/null @@ -1,83 +0,0 @@ -#include <stdio.h> -#include <stdarg.h> - -#include "logging/logging.h" - - -struct honey_log_info_t honey_log_info; - - -static const char * honey_log_level_str_(enum honey_log_level_t level) -{ - switch(honey_log_info.log_level) { - case DEBUG: - return "DEBUG"; - break; - - case INFO: - return "INFO"; - break; - - case WARN: - return "WARN"; - break; - - case ERROR: - return "ERROR"; - break; - - case FATAL: - return "FATAL"; - break; - - default: - return NULL; - break; - } -} - -const char * honey_log_level_str() { - return honey_log_level_str_(honey_log_info.log_level); -} - - -void honey_log_set_level(enum honey_log_level_t level) -{ - honey_log_info.log_level = level; -} - - -enum honey_log_level_t honey_log_get_level() -{ - return honey_log_info.log_level; -} - - -void honey_log_set_file(FILE* file) -{ - honey_log_info.log_file = file; -} - - -FILE * honey_log_get_file() -{ - return honey_log_info.log_file; -} - - -void honey_log(enum honey_log_level_t required_level, - const char *prefix, - const char *fmt, ...) -{ - if (honey_log_info.log_file == NULL) - return; - - if (honey_log_info.log_level >= required_level) { - va_list args; - va_start(args, fmt); - fprintf(honey_log_info.log_file, "%-8s", - prefix); - vfprintf(honey_log_info.log_file, fmt, args); - va_end(args); - } -} |