From e29df66db6497141d28c3e6548faa935c9dbad91 Mon Sep 17 00:00:00 2001 From: mannol Date: Sat, 17 Jan 2015 18:25:47 +0100 Subject: [PATCH] fix_logger-v.0.2 --- toxcore/logger.c | 18 +++++++++--------- toxcore/logger.h | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/toxcore/logger.c b/toxcore/logger.c index 2c6cf345..b51ef2b9 100644 --- a/toxcore/logger.c +++ b/toxcore/logger.c @@ -55,9 +55,9 @@ typedef struct logger { /* For thread synchronisation */ pthread_mutex_t mutex[1]; -} logger; +} Logger; -logger *global = NULL; +Logger *global = NULL; const char *LOG_LEVEL_STR [] = { [LOG_TRACE] = "TRACE", @@ -83,13 +83,13 @@ char *strtime(char *dest, size_t max_len) /** * Public Functions */ -logger *logger_new (const char *file_name, LOG_LEVEL level, const char *id) +Logger *logger_new (const char *file_name, LOG_LEVEL level, const char *id) { #ifndef LOGGING /* Disabled */ return NULL; #endif - logger *retu = calloc(1, sizeof(logger)); + Logger *retu = calloc(1, sizeof(Logger)); if (!retu) return NULL; @@ -143,7 +143,7 @@ FAILURE: return NULL; } -void logger_kill(logger *log) +void logger_kill(Logger *log) { #ifndef LOGGING /* Disabled */ return; @@ -173,7 +173,7 @@ void logger_kill_global(void) global = NULL; } -void logger_set_global(logger *log) +void logger_set_global(Logger *log) { #ifndef LOGGING /* Disabled */ return; @@ -182,7 +182,7 @@ void logger_set_global(logger *log) global = log; } -logger *logger_get_global(void) +Logger *logger_get_global(void) { #ifndef LOGGING /* Disabled */ return NULL; @@ -191,7 +191,7 @@ logger *logger_get_global(void) return global; } -void logger_write (logger *log, LOG_LEVEL level, const char *file, int line, const char *format, ...) +void logger_write (Logger *log, LOG_LEVEL level, const char *file, int line, const char *format, ...) { #ifndef LOGGING /* Disabled */ return; @@ -207,7 +207,7 @@ void logger_write (logger *log, LOG_LEVEL level, const char *file, int line, con "\n"; /* Every new print new line */ - logger *this_log = log ? log : global; + Logger *this_log = log ? log : global; if (!this_log) return; diff --git a/toxcore/logger.h b/toxcore/logger.h index 6f1f6075..0513b32c 100644 --- a/toxcore/logger.h +++ b/toxcore/logger.h @@ -43,26 +43,26 @@ typedef enum { LOG_ERROR } LOG_LEVEL; -typedef struct logger logger; +typedef struct logger Logger; /** * Set 'level' as the lowest printable level. If id == NULL, random number is used. */ -logger *logger_new (const char *file_name, LOG_LEVEL level, const char *id); +Logger *logger_new (const char *file_name, LOG_LEVEL level, const char *id); -void logger_kill (logger *log); +void logger_kill (Logger *log); void logger_kill_global (void); /** * Global logger setter and getter. */ -void logger_set_global (logger *log); -logger *logger_get_global (void); +void logger_set_global (Logger *log); +Logger *logger_get_global (void); /** * Main write function. If logging disabled does nothing. If log == NULL uses global logger. */ -void logger_write (logger *log, LOG_LEVEL level, const char *file, int line, const char *format, ...); +void logger_write (Logger *log, LOG_LEVEL level, const char *file, int line, const char *format, ...); /* To do some checks or similar only when logging, use this */