diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2011-11-29 04:52:52 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-05 17:17:50 +0100 |
commit | 53bd23d0e679746b78d0bcf9234e7b99983e6071 (patch) | |
tree | 51dd89aba98e57c026046fdfbe25ba72aab974a6 /src/menu | |
parent | a9c3f18ebc1dbb1de5c7c9d1585347ed25cc2b52 (diff) | |
download | usdx-53bd23d0e679746b78d0bcf9234e7b99983e6071.tar.gz usdx-53bd23d0e679746b78d0bcf9234e7b99983e6071.tar.xz usdx-53bd23d0e679746b78d0bcf9234e7b99983e6071.zip |
ported from log4cxx to log4cpp
log4cxx depends on Apache Portable Runtime Utility Library, so we
switch to log4cpp with nearly the same features but with no
dependencies for easier porting to other platforms
Diffstat (limited to 'src/menu')
-rw-r--r-- | src/menu/application.cpp | 12 | ||||
-rw-r--r-- | src/menu/application.hpp | 4 | ||||
-rw-r--r-- | src/menu/event_manager.cpp | 6 | ||||
-rw-r--r-- | src/menu/event_manager.hpp | 4 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/menu/application.cpp b/src/menu/application.cpp index 37e532a2..d34b8003 100644 --- a/src/menu/application.cpp +++ b/src/menu/application.cpp @@ -30,11 +30,12 @@ #include "software_mouse_pointer.hpp" #include "loading_frame.hpp" #include <GL/gl.h> +#include <log4cpp/PropertyConfigurator.hh> namespace usdx { - log4cxx::LoggerPtr Application::log = - log4cxx::Logger::getLogger("usdx.menu.application"); + log4cpp::Category& Application::log = + log4cpp::Category::getInstance("usdx.menu.application"); Application* Application::instance = NULL; @@ -43,6 +44,7 @@ namespace usdx fps_manager(NULL), running(false), display_width(800), display_height(600), frames_per_second(50) { + log4cpp::PropertyConfigurator::configure("log4cpp.property"); SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO); } @@ -119,7 +121,7 @@ namespace usdx repaint(); SDL_GL_SwapBuffers(); - LOG4CXX_TRACE(log, "repaint"); + log << log4cpp::Priority::DEBUG << "repaint"; // poll current events while (event_manager.available() && SDL_PollEvent(&event)) { @@ -185,8 +187,8 @@ namespace usdx } if (! display) { - LOG4CXX_ERROR(log, "SDL_SetVideoMode failed."); - throw new std::exception(); + log << log4cpp::Priority::ERROR << "SDL_SetVideoMode failed."; + throw new std::exception(); } init_fps_manager(); diff --git a/src/menu/application.hpp b/src/menu/application.hpp index 914eda71..5564c1ad 100644 --- a/src/menu/application.hpp +++ b/src/menu/application.hpp @@ -29,7 +29,7 @@ #include <SDL/SDL.h> #include <SDL/SDL_framerate.h> -#include <log4cxx/logger.h> +#include <log4cpp/Category.hh> #include <list> #include "drawable_control.hpp" @@ -40,7 +40,7 @@ namespace usdx class Application : public DrawableControl { private: - static log4cxx::LoggerPtr log; + static log4cpp::Category& log; static Application* instance; SDL_Surface* display; diff --git a/src/menu/event_manager.cpp b/src/menu/event_manager.cpp index 8f09f202..7359d77c 100644 --- a/src/menu/event_manager.cpp +++ b/src/menu/event_manager.cpp @@ -29,8 +29,8 @@ namespace usdx { - log4cxx::LoggerPtr EventManager::log = - log4cxx::Logger::getLogger("usdx.menu.event_manager"); + log4cpp::Category& EventManager::log = + log4cpp::Category::getInstance("usdx.menu.event_manager"); EventManager::EventManager(int capacity) : buffer(capacity), waiting(0) @@ -100,7 +100,7 @@ namespace usdx switch (event.type) { case SDL_KEYDOWN: - LOG4CXX_ERROR(log, "key"); + log << log4cpp::Priority::ERROR << "key"; break; case SDL_MOUSEMOTION: diff --git a/src/menu/event_manager.hpp b/src/menu/event_manager.hpp index bfdda35b..e20950cb 100644 --- a/src/menu/event_manager.hpp +++ b/src/menu/event_manager.hpp @@ -38,7 +38,7 @@ #include <boost/thread/thread.hpp> #include <boost/signals2.hpp> -#include <log4cxx/logger.h> +#include <log4cpp/Category.hh> namespace usdx { @@ -52,7 +52,7 @@ namespace usdx class EventManager { private: - static log4cxx::LoggerPtr log; + static log4cpp::Category& log; EventManager(const EventManager&); //< no copy EventManager& operator=(const EventManager&); //< no assignment |