all repos — mgba @ 9a33e5e84f79cb29221bdf71441ebc177b685192

mGBA Game Boy Advance Emulator

Test: Implement logger in CInema
Vicki Pfau vi@endrift.com
Thu, 16 Jul 2020 18:27:06 -0700
commit

9a33e5e84f79cb29221bdf71441ebc177b685192

parent

8b90fa2fe53a925df847017c397fff8dda484d62

1 files changed, 24 insertions(+), 1 deletions(-)

jump to
M src/platform/test/cinema-main.csrc/platform/test/cinema-main.c

@@ -714,7 +714,30 @@ dir->close(dir);

} void _log(struct mLogger* log, int category, enum mLogLevel level, const char* format, va_list args) { - // TODO: Write + UNUSED(log); + if (verbosity < 0) { + return; + } + int mask = mLOG_FATAL; + if (verbosity >= 1) { + mask |= mLOG_ERROR; + } + if (verbosity >= 2) { + mask |= mLOG_WARN; + } + if (verbosity >= 4) { + mask |= mLOG_INFO; + } + if (verbosity >= 5) { + mask |= mLOG_ALL; + } + if (!(mask & level)) { + return; + } + + char buffer[256]; + vsnprintf(buffer, sizeof(buffer), format, args); + CIerr(0, "[%s] %s\n", mLogCategoryName(category), buffer); } int main(int argc, char** argv) {