WIP. Logger for every modules

This commit is contained in:
emeric
2014-08-27 21:25:02 +02:00
parent 6afc4ac291
commit 07624995e7
42 changed files with 292 additions and 223 deletions
+3 -1
View File
@@ -10,6 +10,8 @@
#include "SettingsMediaDirectories.hpp"
#include "SettingsUsers.hpp"
#include "logger/Logger.hpp"
#include "service/ServiceManager.hpp"
#include "service/DatabaseUpdateService.hpp"
@@ -67,7 +69,7 @@ _sessionData(sessionData)
void
Settings::handleDatabaseDirectoriesChanged()
{
std::cout << "Media directories have changed: requesting imediate scan" << std::endl;
LMS_LOG(MOD_UI, SEV_NOTICE) << "Media directories have changed: requesting imediate scan";
// On directory add or delete, request an immediate scan
{
Wt::Dbo::Transaction transaction(_sessionData.getDatabaseHandler().getSession());
+3 -1
View File
@@ -8,6 +8,8 @@
#include <Wt/WPushButton>
#include <Wt/Auth/Identity>
#include "logger/Logger.hpp"
#include "common/Validators.hpp"
#include "SettingsAccountFormView.hpp"
@@ -96,7 +98,7 @@ class AccountFormModel : public Wt::WFormModel
}
catch(Wt::Dbo::Exception& exception)
{
std::cerr << "Dbo exception: " << exception.what() << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
return false;
}
+3 -1
View File
@@ -5,6 +5,8 @@
#include <Wt/WComboBox>
#include <Wt/WPushButton>
#include "logger/Logger.hpp"
#include "common/Validators.hpp"
#include "SettingsAudioFormView.hpp"
@@ -64,7 +66,7 @@ class AudioFormModel : public Wt::WFormModel
}
catch(Wt::Dbo::Exception& exception)
{
std::cerr << "Dbo exception: " << exception.what() << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
return false;
}
+2 -1
View File
@@ -7,6 +7,7 @@
#include <Wt/WFormModel>
#include <Wt/WStringListModel>
#include "logger/Logger.hpp"
#include "database/MediaDirectory.hpp"
#include "common/DirectoryValidator.hpp"
@@ -88,7 +89,7 @@ class DatabaseFormModel : public Wt::WFormModel
}
catch(Wt::Dbo::Exception& exception)
{
std::cerr << "Dbo exception: " << exception.what() << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
return false;
}
@@ -6,6 +6,7 @@
#include <Wt/WComboBox>
#include <Wt/WPushButton>
#include "logger/Logger.hpp"
#include "database/MediaDirectory.hpp"
#include "common/DirectoryValidator.hpp"
@@ -62,7 +63,7 @@ class MediaDirectoryFormModel : public Wt::WFormModel
}
catch(Wt::Dbo::Exception& exception)
{
std::cerr << "Dbo exception: " << exception.what() << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
return false;
}
+5 -3
View File
@@ -8,6 +8,8 @@
#include <Wt/WPushButton>
#include <Wt/Auth/Identity>
#include "logger/Logger.hpp"
#include "common/Validators.hpp"
#include "SettingsUserFormView.hpp"
@@ -147,12 +149,12 @@ class UserFormModel : public Wt::WFormModel
// user may have been deleted by someone else
if (!authUser.isValid()) {
std::cerr << "user identity does not exist!" << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "user identity does not exist!";
return false;
}
else if(!user)
{
std::cerr << "User not found!" << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "User not found!";
return false;
}
@@ -185,7 +187,7 @@ class UserFormModel : public Wt::WFormModel
}
catch(Wt::Dbo::Exception& exception)
{
std::cerr << "Dbo exception: " << exception.what() << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
return false;
}
+4 -2
View File
@@ -6,6 +6,8 @@
#include <Wt/Auth/Identity>
#include "logger/Logger.hpp"
#include "SettingsUserFormView.hpp"
#include "SettingsUsers.hpp"
@@ -77,12 +79,12 @@ Users::refresh(void)
}
catch(Wt::Dbo::Exception& e)
{
std::cerr << "Caught exception when getting userId=" << userId << ": " << e.code() << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Caught exception when getting userId=" << userId << ": " << e.code();
continue;
}
if (!authUser.isValid()) {
std::cerr << "Users::refresh: skipping invalid userId = " << userId << std::endl;
LMS_LOG(MOD_UI, SEV_ERROR) << "Users::refresh: skipping invalid userId = " << userId;
continue;
}