From f5bcb1eacefca867a0c93de43177a57cd3b6c2f2 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 30 Sep 2013 01:48:41 -0700 Subject: [PATCH] Change log level to mask --- src/gba/gba.c | 4 ++-- src/gba/gba.h | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gba/gba.c b/src/gba/gba.c index 4c9e49fa4..792143228 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -51,7 +51,7 @@ void GBAInit(struct GBA* gba) { gba->springIRQ = 0; gba->keySource = 0; - gba->logLevel = GBA_LOG_INFO; + gba->logLevel = GBA_LOG_INFO | GBA_LOG_WARN | GBA_LOG_ERROR; ARMReset(&gba->cpu); } @@ -375,7 +375,7 @@ void GBALog(struct GBA* gba, enum GBALogLevel level, const char* format, ...) { gba = threadContext->gba; } } - if (gba && level < gba->logLevel) { + if (gba && !(level & gba->logLevel)) { return; } va_list args; diff --git a/src/gba/gba.h b/src/gba/gba.h index dce638cae..50b6ff704 100644 --- a/src/gba/gba.h +++ b/src/gba/gba.h @@ -30,12 +30,13 @@ enum GBAError { }; enum GBALogLevel { - GBA_LOG_STUB, - GBA_LOG_DEBUG, - GBA_LOG_GAME_ERROR, - GBA_LOG_INFO, - GBA_LOG_WARN, - GBA_LOG_ERROR, + GBA_LOG_STUB = 0x01, + GBA_LOG_DEBUG = 0x02, + GBA_LOG_INFO = 0x04, + GBA_LOG_WARN = 0x08, + GBA_LOG_ERROR = 0x10, + + GBA_LOG_GAME_ERROR = 0x100 }; enum GBAKey { @@ -85,7 +86,7 @@ struct GBA { const char* savefile; enum GBAError errno; const char* errstr; - enum GBALogLevel logLevel; + int logLevel; }; void GBAInit(struct GBA* gba);