From b6bf8e607146202b82b7943147fc5a99d4c46a60 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 11 Sep 2017 19:58:07 +0300 Subject: Add option to set sdl logging level. Only for SDL2. --- src/utils/sdl2logger.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/utils/sdl2logger.cpp') diff --git a/src/utils/sdl2logger.cpp b/src/utils/sdl2logger.cpp index 7f7813521..98c7d8338 100644 --- a/src/utils/sdl2logger.cpp +++ b/src/utils/sdl2logger.cpp @@ -134,8 +134,23 @@ static SDL_AssertState assertCallback(const SDL_AssertData *data, void SDL2Logger::init() { +#ifdef UNITTESTS + SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); +#else // UNITTESTS + + SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE); +#endif // UNITTESTS + SDL_LogSetOutputFunction(&logCallback, nullptr); SDL_SetAssertionHandler(&assertCallback, nullptr); } +void SDL2Logger::setLogLevel(const int level) +{ + if (level > 0) + SDL_LogSetAllPriority(static_cast(level)); + else + SDL_LogResetPriorities(); +} + #endif // USE_SDL2 -- cgit v1.2.3-70-g09d2