diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-30 22:28:33 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-30 22:28:33 +0200 |
commit | 1a43fad56dc945c72a4ab711d2c9ff6d1a5a1502 (patch) | |
tree | e2b6847ce5e6a6d41269f1d2fa30011060abcd08 /src/modules | |
parent | 241f1947580df7f905ed3d6969cc3a6a4bb99f5a (diff) | |
download | mad-1a43fad56dc945c72a4ab711d2c9ff6d1a5a1502.tar mad-1a43fad56dc945c72a4ab711d2c9ff6d1a5a1502.zip |
Added Format class for improved logging experience :)
Diffstat (limited to 'src/modules')
6 files changed, 11 insertions, 11 deletions
diff --git a/src/modules/AuthProviderFile/AuthProviderFile.cpp b/src/modules/AuthProviderFile/AuthProviderFile.cpp index 4522092..7ce1fae 100644 --- a/src/modules/AuthProviderFile/AuthProviderFile.cpp +++ b/src/modules/AuthProviderFile/AuthProviderFile.cpp @@ -35,7 +35,7 @@ namespace AuthProviderFile { void AuthProviderFile::readFile(const std::string &name) { std::ifstream stream(name.c_str()); if(!stream.good()) { - application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Can't read file '%s'.", name.c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("AuthProviderFile: Can't read file '%1%'.") % name); return; } @@ -50,7 +50,7 @@ void AuthProviderFile::readFile(const std::string &name) { boost::smatch match; if(!boost::regex_match(line, match, regex)) { - application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Malformed line in file '%s'.", name.c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("AuthProviderFile: Malformed line in file '%s'.") % name); continue; } @@ -72,7 +72,7 @@ void AuthProviderFile::readFile(const std::string &name) { unsigned char byte; if(std::sscanf(buffer, "%hhx", &byte) != 1) { - application->logf(Core::Logger::LOG_WARNING, "AuthProviderFile: Malformed hash in file '%s'.", name.c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("AuthProviderFile: Malformed hash in file '%s'.") % name); data.clear(); break; } diff --git a/src/modules/FileLogger/Module.cpp b/src/modules/FileLogger/Module.cpp index 25a54b4..cfaf47f 100644 --- a/src/modules/FileLogger/Module.cpp +++ b/src/modules/FileLogger/Module.cpp @@ -54,7 +54,7 @@ void Module::configure() { logger->setLevel(Core::LogManager::parseLevel(level)); } catch(Core::Exception e) { - application->logf(Core::Logger::LOG_WARNING, "Unknown log level '%s'.", level.toLocale().c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("Unknown log level '%1%'.") % level); } } } diff --git a/src/modules/StorageBackendFile/StorageBackendFile.cpp b/src/modules/StorageBackendFile/StorageBackendFile.cpp index e801a64..c7017c0 100644 --- a/src/modules/StorageBackendFile/StorageBackendFile.cpp +++ b/src/modules/StorageBackendFile/StorageBackendFile.cpp @@ -38,7 +38,7 @@ void StorageBackendFile::configure() { } if(!boost::filesystem::is_directory(storageRoot)) { - application->logf("StorageBackendFile: Can't create directory: '%s'.", storageRoot.string().c_str()); + application->log(Core::Format("StorageBackendFile: Can't create directory: '%1%'.") % storageRoot.string()); return; } diff --git a/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp b/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp index a19769c..fc90705 100644 --- a/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp +++ b/src/modules/UserConfigBackendHome/UserConfigBackendHome.cpp @@ -37,8 +37,8 @@ void UserConfigBackendHome::configure() { dirMode = std::strtoul(application->getConfigManager()->get("UserManager.UserDirMode", "775").toString().c_str(), 0, 8); if(dirMode > 07777) { - application->logf(Core::Logger::LOG_WARNING, "UserBackendHome: Invalid configuration: UserDirMode '%s'", - application->getConfigManager()->get("UserManager.UserDirMode").toLocale().c_str()); + application->log(Core::Logger::LOG_WARNING, Core::Format("UserBackendHome: Invalid configuration: UserDirMode '%1%'") + % application->getConfigManager()->get("UserManager.UserDirMode")); dirMode = 0775; } } diff --git a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp index 61ad996..72c8160 100644 --- a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp +++ b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.cpp @@ -68,7 +68,7 @@ void UserConfigBackendKrb5::_connect() { const_cast<char*>(KADM5_ADMIN_SERVICE), ¶ms, KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, 0, &handle); if(err) { - application->logf(Core::Logger::LOG_USER, Core::Logger::LOG_ERROR, "kadm5_init_with_password: %s", krb5_get_error_message(context, err)); + application->log(Core::Logger::LOG_USER, Core::Logger::LOG_ERROR, Core::Format("kadm5_init_with_password: %1%") % krb5_get_error_message(context, err)); return; } } @@ -84,7 +84,7 @@ void UserConfigBackendKrb5::_connect() { const_cast<char*>(KADM5_ADMIN_SERVICE), ¶ms, KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, 0, &handle); if(err) { - application->logf(Core::Logger::LOG_USER, Core::Logger::LOG_ERROR, "kadm5_init_with_skey: %s", krb5_get_error_message(context, err)); + application->log(Core::Logger::LOG_USER, Core::Logger::LOG_ERROR, Core::Format("kadm5_init_with_skey: %1%") % krb5_get_error_message(context, err)); return; } } @@ -226,7 +226,7 @@ void UserConfigBackendKrb5::deleteUser(const Common::UserInfo &userInfo) throw(C krb5_free_principal(context, princ); if(err) - application->logf(Core::Logger::LOG_USER, Core::Logger::LOG_WARNING, "kadm5_delete_principal: %s", krb5_get_error_message(context, err)); + application->log(Core::Logger::LOG_USER, Core::Logger::LOG_WARNING, Core::Format("kadm5_delete_principal: %1%") % krb5_get_error_message(context, err)); } void UserConfigBackendKrb5::setPassword(const Common::UserInfo &userInfo, const Core::String &password) throw(Core::Exception) { diff --git a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h index 64f8501..c02f868 100644 --- a/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h +++ b/src/modules/UserConfigBackendKrb5/UserConfigBackendKrb5.h @@ -64,7 +64,7 @@ class UserConfigBackendKrb5 : public Common::UserConfigBackend, private Core::Co UserConfigBackendKrb5(Common::Application *application0) : application(application0), handle(0) { krb5_error_code err = krb5_init_context(&context); if(err) { - application->logf("Unable to initialize kerberos context: %s", std::strerror(err)); + application->log(Core::Format("Unable to initialize kerberos context: %1%") % std::strerror(err)); context = 0; return; } |