summaryrefslogtreecommitdiff
path: root/src/joystick.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-07-04 12:13:01 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-07-04 21:17:55 +0200
commit1debcc8032f01dd2bb64f2725143121b57320876 (patch)
tree85cba14f5309a487913c0c430811273343211f8f /src/joystick.cpp
parent3fb53be63095dad2ebcfd52d44f13d20f630e478 (diff)
downloadmana-1debcc8032f01dd2bb64f2725143121b57320876.tar.gz
mana-1debcc8032f01dd2bb64f2725143121b57320876.tar.bz2
mana-1debcc8032f01dd2bb64f2725143121b57320876.tar.xz
mana-1debcc8032f01dd2bb64f2725143121b57320876.zip
Added logging priorities and use SDLs logging facilities
By using SDL logging, we can rely on SDL to filter the log messages by their priority before they get sent to our custom output function. For example, we now no longer get entries for created and destroyed Window instances by default, since these have only "debug" priority whereas the default priority for the "app" category is "info". We can also get log messages raised by SDL itself in our log now. Log levels can be controlled per category through the "SDL_LOGGING" environment variable. Many existing log messages have been assigned a category based on their existing prefix.
Diffstat (limited to 'src/joystick.cpp')
-rw-r--r--src/joystick.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/joystick.cpp b/src/joystick.cpp
index c6e106bf..070e9dcf 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -36,9 +36,9 @@ void Joystick::init()
SDL_JoystickEventState(SDL_ENABLE);
joystickCount = SDL_NumJoysticks();
- logger->log("%i joysticks/gamepads found", joystickCount);
+ Log::info("%i joysticks/gamepads found", joystickCount);
for (int i = 0; i < joystickCount; i++)
- logger->log("- %s", SDL_JoystickNameForIndex(i));
+ Log::info("- %s", SDL_JoystickNameForIndex(i));
}
Joystick::Joystick(int no)
@@ -57,14 +57,14 @@ Joystick::Joystick(int no)
// TODO Bail out!
if (!mJoystick)
{
- logger->log("Couldn't open joystick: %s", SDL_GetError());
+ Log::info("Couldn't open joystick: %s", SDL_GetError());
return;
}
- logger->log("Axes: %i ", SDL_JoystickNumAxes(mJoystick));
- logger->log("Balls: %i", SDL_JoystickNumBalls(mJoystick));
- logger->log("Hats: %i", SDL_JoystickNumHats(mJoystick));
- logger->log("Buttons: %i", SDL_JoystickNumButtons(mJoystick));
+ Log::info("Axes: %i ", SDL_JoystickNumAxes(mJoystick));
+ Log::info("Balls: %i", SDL_JoystickNumBalls(mJoystick));
+ Log::info("Hats: %i", SDL_JoystickNumHats(mJoystick));
+ Log::info("Buttons: %i", SDL_JoystickNumButtons(mJoystick));
}
Joystick::~Joystick()