Change log level to mask

This commit is contained in:
Jeffrey Pfau 2013-09-30 01:48:41 -07:00
parent aaaafb90a5
commit f5bcb1eace
2 changed files with 10 additions and 9 deletions

View File

@ -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;

View File

@ -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);