From be9ebc1104574e5e81e19c5caba0c23b54df826d Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Wed, 13 Jan 2010 20:24:07 -0700 Subject: [PATCH 1/1] moved log level from configure to setting --- configure.ac | 10 ---------- data/yoinkrc | 15 ++++++++++++--- src/MainLayer.cc | 19 +++++-------------- src/Moof/Video.cc | 2 +- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index 054c4ac..b52ea76 100644 --- a/configure.ac +++ b/configure.ac @@ -99,12 +99,6 @@ AC_ARG_ENABLE([qt4], [qt4=$enableval], [qt4=no]) -AC_ARG_WITH([log-level], - [AS_HELP_STRING([--with-log-level=NUM], - [0, none... 1, errors... 4, everything (default: 3)])], - [log_level=$withval], - [log_level=3]) - if test x$debug = xyes then @@ -151,9 +145,6 @@ then [Define to 1 if you want to use QT4 info/error dialogs.]) fi -AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level], - [Define to detail level of logging.]) - if test "x$prefix" = xNONE then @@ -371,7 +362,6 @@ echo "" echo " Target: $target" echo " Prefix: $prefix" echo " Data Directory: $DATADIR" -echo " Log Level: $log_level" echo " Debug: $debug" echo " Double Precision: $double_precision" echo " Profile: $profile" diff --git a/data/yoinkrc b/data/yoinkrc index d7f97cc..36b6e58 100644 --- a/data/yoinkrc +++ b/data/yoinkrc @@ -35,12 +35,12 @@ framerate = 50 -- Set this to print the current actual framerate to the console each -- second. -showfps = true +showfps = false -- Set this to run the game in full-screen mode. The default behavior is -- to run the game in a window. -fullscreen = true +fullscreen = false -- If the game is running in a window, set this to also make the window -- resizable. This has no effective if the fullscreen option is true. @@ -53,7 +53,7 @@ resizable = true -- default behavior is to pick a native resolution. Otherwise, the game -- window will default to 800x600. ---videomode = {800, 600} +videomode = {800, 600} -- Set this to make the cursor remain visible as you mouse over the view of -- the game. @@ -71,3 +71,12 @@ doublebuffer = true swapcontrol = true +-- Set the level of log detail that will be printed to the console. +-- Possible values are: +-- 0 print nothing +-- 1 errors only +-- 2 include warnings +-- 3 print everything, including debug messages + +loglevel = 2 + diff --git a/src/MainLayer.cc b/src/MainLayer.cc index 5f097ea..ad2dbbc 100644 --- a/src/MainLayer.cc +++ b/src/MainLayer.cc @@ -289,17 +289,6 @@ int main(int argc, char* argv[]) } -#if YOINK_LOGLEVEL >= 3 - Mf::Log::setLevel(Mf::Log::INFO); -#elif YOINK_LOGLEVEL >= 2 - Mf::Log::setLevel(Mf::Log::WARNING); -#elif YOINK_LOGLEVEL >= 1 - Mf::Log::setLevel(Mf::Log::ERROR); -#elif YOINK_LOGLEVEL - Mf::Log::setLevel(Mf::Log::NONE); -#endif - - // Add search paths; they should be searched in this order: // 1. YOINK_DATADIR (environment) // 2. YOINK_DATADIR (configure) @@ -319,9 +308,7 @@ int main(int argc, char* argv[]) // 3. $HOME/.yoinkrc // 4. YOINKRC (environment) - std::string configFiles; - - configFiles += Mf::Resource::getPath("yoinkrc"); + std::string configFiles = Mf::Resource::getPath("yoinkrc"); #if !defined(_WIN32) && !defined(__WIN32__) configFiles += ":/etc/yoinkrc"; #endif @@ -337,6 +324,10 @@ int main(int argc, char* argv[]) Mf::Settings& settings = Mf::Settings::getInstance(); settings.loadFromFile(configFiles); settings.parseArgs(argc, argv); + + Mf::Log::Level logLevel; + if (settings.get("loglevel", logLevel)) Mf::Log::setLevel(logLevel); + Mf::engine.initWithSettings(settings); std::string iconFile = Mf::Resource::getPath(PACKAGE".png"); diff --git a/src/Moof/Video.cc b/src/Moof/Video.cc index ba375e1..544e172 100644 --- a/src/Moof/Video.cc +++ b/src/Moof/Video.cc @@ -132,7 +132,7 @@ void Video::setVideoMode(const long mode[3]) // on win32, creating a new context via SDL_SetVideoMode will wipe // out the GL state, so we gotta notify everyone to reload their // state after the change - Engine::getInstance().dispatch("video.newcontext"); + engine.dispatch("video.newcontext"); logInfo("video context recreated"); #endif -- 2.43.0