From 1a43fad56dc945c72a4ab711d2c9ff6d1a5a1502 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 30 Sep 2009 22:28:33 +0200 Subject: Added Format class for improved logging experience :) --- src/Common/ModuleManager.cpp | 6 +++--- src/Common/UserManager.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Common') diff --git a/src/Common/ModuleManager.cpp b/src/Common/ModuleManager.cpp index c119eab..0347971 100644 --- a/src/Common/ModuleManager.cpp +++ b/src/Common/ModuleManager.cpp @@ -62,7 +62,7 @@ void ModuleManager::configure() { std::vector entries = application->getConfigManager()->getEntries("LoadModule"); for(std::vector::iterator entry = entries.begin(); entry != entries.end(); ++entry) { if(!loadModule((*entry)->getValue().toLocale())) - application->logf(Core::Logger::LOG_ERROR, "Can't load module '%s'.", (*entry)->getValue().toLocale().c_str()); + application->log(Core::Logger::LOG_ERROR, Core::Format("Can't load module '%1%'.") % (*entry)->getValue()); } } @@ -88,9 +88,9 @@ bool ModuleManager::loadModule(const std::string &name) { if(!handle) { #ifdef WIN32 - application->logf(Core::Logger::LOG_VERBOSE, "loadModule: Can't open module: Error %u", GetLastError()); + application->log(Core::Logger::LOG_VERBOSE, Core::Format("loadModule: Can't open module: Error %1%") % GetLastError()); #else - application->logf(Core::Logger::LOG_VERBOSE, "loadModule: Can't open module: %s", dlerror()); + application->log(Core::Logger::LOG_VERBOSE, Core::Format("loadModule: Can't open module: %1%") % dlerror()); #endif return false; } diff --git a/src/Common/UserManager.cpp b/src/Common/UserManager.cpp index e71c38e..917c61a 100644 --- a/src/Common/UserManager.cpp +++ b/src/Common/UserManager.cpp @@ -39,29 +39,29 @@ UserManager::~UserManager() { void UserManager::configure() { minUid = std::strtoul(application->getConfigManager()->get("UserManager.MinUid", "1000").toString().c_str(), 0, 10); if(minUid == 0) { - application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: MinUid '%s'", - application->getConfigManager()->get("UserManager.MinUid").toLocale().c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("UserBackendHome: Invalid configuration: MinUid '%1%'") + % application->getConfigManager()->get("UserManager.MinUid")); minUid = 1000; } maxUid = std::strtoul(application->getConfigManager()->get("UserManager.MaxUid", "29999").toString().c_str(), 0, 10); if(maxUid == 0) { - application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: MaxUid '%s'", - application->getConfigManager()->get("UserManager.MaxUid").toLocale().c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("UserBackendHome: Invalid configuration: MaxUid '%1%'") + % application->getConfigManager()->get("UserManager.MaxUid")); maxUid = 29999; } minGid = std::strtoul(application->getConfigManager()->get("UserManager.MinGid", "1000").toString().c_str(), 0, 10); if(minGid == 0) { - application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: MinGid '%s'", - application->getConfigManager()->get("UserManager.MinGid").toLocale().c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("UserBackendHome: Invalid configuration: MinGid '%1%'") + % application->getConfigManager()->get("UserManager.MinGid")); minGid = 1000; } maxGid = std::strtoul(application->getConfigManager()->get("UserManager.MaxGid", "29999").toString().c_str(), 0, 10); if(maxGid == 0) { - application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: MaxGid '%s'", - application->getConfigManager()->get("UserManager.MaxGid").toLocale().c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("UserBackendHome: Invalid configuration: MaxGid '%1%'") + % application->getConfigManager()->get("UserManager.MaxGid")); maxGid = 29999; } } -- cgit v1.2.3