diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-03-18 23:47:45 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 2323ca6c9ec3c8ee76b9acf13745b80b92952a6a (patch) | |
tree | 93013237dbcb0fa96ceb5f3c026fd040aff464cf /src/std/log.c | |
parent | 5a93c32a59775cd1be4b4f450e8230016b434366 (diff) |
Add struct, import caching, binop ops etc
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 |