summaryrefslogtreecommitdiff
path: root/src/utils/sdl2logger.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-11 19:58:07 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-11 23:36:49 +0300
commitb6bf8e607146202b82b7943147fc5a99d4c46a60 (patch)
tree0465526af0ebefee944382af2869f08bfbcc7c94 /src/utils/sdl2logger.cpp
parentdbf65ef9c85f1b1b93fc9666bda31c5e5171b8c7 (diff)
downloadplus-b6bf8e607146202b82b7943147fc5a99d4c46a60.tar.gz
plus-b6bf8e607146202b82b7943147fc5a99d4c46a60.tar.bz2
plus-b6bf8e607146202b82b7943147fc5a99d4c46a60.tar.xz
plus-b6bf8e607146202b82b7943147fc5a99d4c46a60.zip
Add option to set sdl logging level.
Only for SDL2.
Diffstat (limited to 'src/utils/sdl2logger.cpp')
-rw-r--r--src/utils/sdl2logger.cpp15
1 files changed, 15 insertions, 0 deletions
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<SDL_LogPriority>(level));
+ else
+ SDL_LogResetPriorities();
+}
+
#endif // USE_SDL2