diff options
Diffstat (limited to 'src/std/log.c')
-rw-r--r-- | src/std/log.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/std/log.c b/src/std/log.c index 2563bdc..2059445 100644 --- a/src/std/log.c +++ b/src/std/log.c @@ -4,6 +4,8 @@ #include <stdio.h> #include <stdarg.h> +/*#define LOG_DEBUG*/ + static amal_mutex mutex; static bool mutex_initialized = bool_false; @@ -21,6 +23,7 @@ amal_mutex* amal_log_get_mutex() { } void amal_log_debug(const char *fmt, ...) { +#ifdef LOG_DEBUG va_list args; mutex_init(); ignore_result_int(amal_mutex_lock(&mutex, NULL)); @@ -30,13 +33,16 @@ void amal_log_debug(const char *fmt, ...) { va_end(args); fprintf(stderr, "\n"); ignore_result_int(amal_mutex_unlock(&mutex)); +#else + (void)fmt; +#endif } void amal_log_error(const char *fmt, ...) { va_list args; mutex_init(); ignore_result_int(amal_mutex_lock(&mutex, NULL)); - fprintf(stderr, "Error: "); + fprintf(stderr, "\x1b[1;31mError:\x1b[0m "); va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); @@ -66,11 +72,4 @@ void amal_log_warning(const char *fmt, ...) { va_end(args); fprintf(stderr, "\n"); ignore_result_int(amal_mutex_unlock(&mutex)); -} - -void amal_log_perror(const char *prefix) { - mutex_init(); - ignore_result_int(amal_mutex_lock(&mutex, NULL)); - perror(prefix); - ignore_result_int(amal_mutex_unlock(&mutex)); -} +}
\ No newline at end of file |