all repos — mgba @ 5e75c94967e295531e46818eedb22ccb3efbbcf8

mGBA Game Boy Advance Emulator

Core: Add ability to set default logger
Jeffrey Pfau jeffrey@endrift.com
Sun, 07 Feb 2016 03:38:35 -0800
commit

5e75c94967e295531e46818eedb22ccb3efbbcf8

parent

752b4faaff506092ed6017f14d6adb6463337243

2 files changed, 8 insertions(+), 1 deletions(-)

jump to
M src/core/log.csrc/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.hsrc/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);