Core: Add ability to set default logger
Jeffrey Pfau jeffrey@endrift.com
Sun, 07 Feb 2016 03:38:35 -0800
2 files changed,
8 insertions(+),
1 deletions(-)
M
src/core/log.c
→
src/core/log.c
@@ -9,12 +9,18 @@ #include "core/thread.h"
#define MAX_CATEGORY 64 +static struct mLogger* _defaultLogger = NULL; + struct mLogger* mLogGetContext(void) { struct mLogger* logger = mCoreThreadLogger(); if (logger) { return logger; } - return NULL; // TODO + return _defaultLogger; +} + +void mLogSetDefaultLogger(struct mLogger* logger) { + _defaultLogger = logger; } static int _category = 0;
M
src/core/log.h
→
src/core/log.h
@@ -23,6 +23,7 @@ void (*log)(struct mLogger*, int category, enum mLogLevel level, const char* format, va_list args);
}; struct mLogger* mLogGetContext(void); +void mLogSetDefaultLogger(struct mLogger*); int mLogGenerateCategory(const char*); const char* mLogCategoryName(int);