Updated Logger to use enum class
This commit is contained in:
@@ -169,7 +169,7 @@ LmsApplication::handleAuthEvent(void)
|
||||
{
|
||||
if (DbHandler().getLogin().loggedIn())
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_NOTICE) << "User '" << CurrentAuthUser().identity(Wt::Auth::Identity::LoginName) << "' logged in from '" << Wt::WApplication::instance()->environment().clientAddress() << "', user agent = " << Wt::WApplication::instance()->environment().agent() << ", session = " << Wt::WApplication::instance()->sessionId();
|
||||
LMS_LOG(UI, INFO) << "User '" << CurrentAuthUser().identity(Wt::Auth::Identity::LoginName) << "' logged in from '" << Wt::WApplication::instance()->environment().clientAddress() << "', user agent = " << Wt::WApplication::instance()->environment().agent() << ", session = " << Wt::WApplication::instance()->sessionId();
|
||||
|
||||
this->root()->setOverflow(Wt::WContainerWidget::OverflowHidden);
|
||||
setConfirmCloseMessage("Closing LMS. Are you sure?");
|
||||
@@ -243,7 +243,7 @@ LmsApplication::handleAuthEvent(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_NOTICE) << "User logged out, session = " << Wt::WApplication::instance()->sessionId();
|
||||
LMS_LOG(UI, INFO) << "User logged out, session = " << Wt::WApplication::instance()->sessionId();
|
||||
|
||||
quit("");
|
||||
redirect("/");
|
||||
|
||||
@@ -64,7 +64,7 @@ AudioMediaPlayer::AudioMediaPlayer(Wt::WContainerWidget *parent)
|
||||
}
|
||||
}
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_INFO) << "Audio player using encoding " << _encoding;
|
||||
LMS_LOG(UI, INFO) << "Audio player using encoding " << _encoding;
|
||||
|
||||
// Current Media info
|
||||
Wt::WHBoxLayout *currentMediaLayout = new Wt::WHBoxLayout();
|
||||
@@ -219,7 +219,7 @@ AudioMediaPlayer::load(Database::Track::id_type trackId)
|
||||
if (!mediaFile.open())
|
||||
{
|
||||
// No longer exist ? TODO next?
|
||||
LMS_LOG(MOD_UI, SEV_INFO) << "Cannot open file '" << path << "'";
|
||||
LMS_LOG(UI, INFO) << "Cannot open file '" << path << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ _playQueue(nullptr)
|
||||
_mediaPlayer->loop().connect(boost::bind(&PlayQueue::setLoop,_playQueue, _1));
|
||||
|
||||
_playQueue->tracksUpdated().connect(std::bind([=] () {
|
||||
LMS_LOG(MOD_UI, SEV_INFO) << "Playqueue updated!";
|
||||
LMS_LOG(UI, INFO) << "Playqueue updated!";
|
||||
|
||||
playlistSaveFromPlayqueue(CurrentQueuePlaylistName);
|
||||
}));
|
||||
@@ -308,14 +308,14 @@ Audio::playlistShowSaveDialog(std::string playlistName)
|
||||
void
|
||||
Audio::playlistSaveFromPlayqueue(std::string playlistName)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_INFO) << "Saving playqueue to playlist '" << playlistName << "'";
|
||||
LMS_LOG(UI, INFO) << "Saving playqueue to playlist '" << playlistName << "'";
|
||||
|
||||
Wt::Dbo::Transaction transaction(DboSession());
|
||||
|
||||
Playlist::pointer playlist = Playlist::get(DboSession(), playlistName, CurrentUser());
|
||||
if (playlist)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_INFO) << "Erasing playlist '" << playlistName << "'";
|
||||
LMS_LOG(UI, INFO) << "Erasing playlist '" << playlistName << "'";
|
||||
playlist.remove();
|
||||
}
|
||||
|
||||
@@ -333,13 +333,13 @@ Audio::playlistSaveFromPlayqueue(std::string playlistName)
|
||||
PlaylistEntry::create(DboSession(), track, playlist, pos++);
|
||||
}
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_INFO) << "Saving playqueue to playlist '" << playlistName << "' done. Contains " << pos << " entries";
|
||||
LMS_LOG(UI, INFO) << "Saving playqueue to playlist '" << playlistName << "' done. Contains " << pos << " entries";
|
||||
}
|
||||
|
||||
void
|
||||
Audio::playlistLoadToPlayqueue(std::string playlistName)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Loading playlist '" << playlistName << "' to playqueue";
|
||||
LMS_LOG(UI, DEBUG) << "Loading playlist '" << playlistName << "' to playqueue";
|
||||
|
||||
std::vector<Track::id_type> entries;
|
||||
|
||||
@@ -356,7 +356,7 @@ Audio::playlistLoadToPlayqueue(std::string playlistName)
|
||||
_playQueue->clear();
|
||||
_playQueue->addTracks(entries);
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Loading playlist '" << playlistName << "' to playqueue done. " << entries.size() << " entries";
|
||||
LMS_LOG(UI, DEBUG) << "Loading playlist '" << playlistName << "' to playqueue done. " << entries.size() << " entries";
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ Audio::playlistRefreshMenus()
|
||||
Wt::Dbo::Transaction transaction(DboSession());
|
||||
|
||||
// Clear playlists in each menu
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Save item count: " << _popupMenuSave->count();
|
||||
LMS_LOG(UI, DEBUG) << "Save item count: " << _popupMenuSave->count();
|
||||
|
||||
WPopupMenuClear(_popupMenuDelete);
|
||||
WPopupMenuClear(_popupMenuLoad);
|
||||
@@ -457,7 +457,7 @@ Audio::playSelectedTracks(PlayQueueAddType addType)
|
||||
{
|
||||
std::vector<Track::id_type> trackIds;
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Playing selected tracks... nb selected = " << _trackView->getNbSelectedTracks() << ", add type = " << (addType == PlayQueueAddAllTracks ? "AddAll" : "AddSelected");
|
||||
LMS_LOG(UI, DEBUG) << "Playing selected tracks... nb selected = " << _trackView->getNbSelectedTracks() << ", add type = " << (addType == PlayQueueAddAllTracks ? "AddAll" : "AddSelected");
|
||||
|
||||
_playQueue->clear();
|
||||
|
||||
@@ -472,7 +472,7 @@ Audio::playSelectedTracks(PlayQueueAddType addType)
|
||||
break;
|
||||
case PlayQueueAddSelectedTracks:
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Adding selected tracks...";
|
||||
LMS_LOG(UI, DEBUG) << "Adding selected tracks...";
|
||||
|
||||
// If nothing selected, get all the track and play everything
|
||||
if (_trackView->getNbSelectedTracks() == 0)
|
||||
|
||||
@@ -371,7 +371,7 @@ PlayQueue::addTracks(const std::vector<Database::Track::id_type>& trackIds)
|
||||
{
|
||||
using namespace Database;
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Adding " << trackIds.size() << " tracks to play queue";
|
||||
LMS_LOG(UI, DEBUG) << "Adding " << trackIds.size() << " tracks to play queue";
|
||||
|
||||
// Add tracks to model
|
||||
for (Track::id_type trackId : trackIds)
|
||||
@@ -465,7 +465,7 @@ PlayQueue::playPrevious(void)
|
||||
void
|
||||
PlayQueue::readTrack(int rowPos)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Reading track at pos " << rowPos << ", row count = " << _model->rowCount();
|
||||
LMS_LOG(UI, DEBUG) << "Reading track at pos " << rowPos << ", row count = " << _model->rowCount();
|
||||
|
||||
if (rowPos < _model->rowCount())
|
||||
{
|
||||
|
||||
@@ -150,7 +150,7 @@ TrackView::refresh(SearchFilter& filter)
|
||||
void
|
||||
TrackView::getSelectedTracks(std::vector<Track::id_type>& track_ids)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting selected tracks...";
|
||||
LMS_LOG(UI, DEBUG) << "Getting selected tracks...";
|
||||
|
||||
Wt::WModelIndexSet indexSet = this->selectedIndexes();
|
||||
|
||||
@@ -164,7 +164,7 @@ TrackView::getSelectedTracks(std::vector<Track::id_type>& track_ids)
|
||||
track_ids.push_back(id);
|
||||
}
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all selected tracks: " << track_ids.size();
|
||||
LMS_LOG(UI, DEBUG) << "Getting all selected tracks: " << track_ids.size();
|
||||
}
|
||||
|
||||
std::size_t
|
||||
@@ -192,7 +192,7 @@ TrackView::getFirstSelectedTrackPosition(void)
|
||||
void
|
||||
TrackView::getTracks(std::vector<Track::id_type>& trackIds)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks...";
|
||||
LMS_LOG(UI, DEBUG) << "Getting all tracks...";
|
||||
|
||||
Wt::Dbo::Transaction transaction(DboSession());
|
||||
Wt::Dbo::collection<Track::UIQueryResult> results = _queryModel.query();
|
||||
@@ -203,7 +203,7 @@ TrackView::getTracks(std::vector<Track::id_type>& trackIds)
|
||||
trackIds.push_back(id);
|
||||
}
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Getting all tracks done! " << trackIds.size() << " tracks!";
|
||||
LMS_LOG(UI, DEBUG) << "Getting all tracks done! " << trackIds.size() << " tracks!";
|
||||
}
|
||||
|
||||
} // namespace Desktop
|
||||
|
||||
@@ -156,7 +156,7 @@ Audio::Audio(Wt::WContainerWidget *parent)
|
||||
|
||||
trackSearch->trackPlay().connect(std::bind([=] (Track::id_type id)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Playing track id " << id;
|
||||
LMS_LOG(UI, DEBUG) << "Playing track id " << id;
|
||||
// TODO reduce transaction scope here
|
||||
Wt::Dbo::Transaction transaction(DboSession());
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ AvConvTranscodeStreamResource::AvConvTranscodeStreamResource(boost::filesystem::
|
||||
_filePath(p),
|
||||
_parameters( parameters )
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "CONSTRUCTING RESOURCE";
|
||||
LMS_LOG(UI, DEBUG) << "CONSTRUCTING RESOURCE";
|
||||
}
|
||||
|
||||
AvConvTranscodeStreamResource::~AvConvTranscodeStreamResource()
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "DESTRUCTING RESOURCE";
|
||||
LMS_LOG(UI, DEBUG) << "DESTRUCTING RESOURCE";
|
||||
beingDeleted();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
||||
// see if this request is for a continuation:
|
||||
Wt::Http::ResponseContinuation *continuation = request.continuation();
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Handling new request. Continuation = " << continuation;
|
||||
LMS_LOG(UI, DEBUG) << "Handling new request. Continuation = " << continuation;
|
||||
|
||||
std::shared_ptr<Av::Transcoder> transcoder;
|
||||
if (continuation)
|
||||
@@ -56,15 +56,15 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
||||
|
||||
if (!transcoder)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Launching transcoder";
|
||||
LMS_LOG(UI, DEBUG) << "Launching transcoder";
|
||||
transcoder = std::make_shared<Av::Transcoder>( _filePath, _parameters);
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Mime type set to '" << Av::encoding_to_mimetype(_parameters.getEncoding());
|
||||
LMS_LOG(UI, DEBUG) << "Mime type set to '" << Av::encoding_to_mimetype(_parameters.getEncoding());
|
||||
response.setMimeType( Av::encoding_to_mimetype(_parameters.getEncoding()) );
|
||||
|
||||
if (!transcoder->start())
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Cannot start transcoder";
|
||||
LMS_LOG(UI, ERROR) << "Cannot start transcoder";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -79,10 +79,10 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
||||
// Give the client all the output data
|
||||
response.out().write(reinterpret_cast<char*>(&data[0]), data.size());
|
||||
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "Written " << data.size() << " bytes! complete = " << std::boolalpha << transcoder->isComplete();
|
||||
LMS_LOG(UI, DEBUG) << "Written " << data.size() << " bytes! complete = " << std::boolalpha << transcoder->isComplete();
|
||||
|
||||
if (!response.out())
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Write failed!";
|
||||
LMS_LOG(UI, ERROR) << "Write failed!";
|
||||
}
|
||||
|
||||
if (!transcoder->isComplete() && response.out()) {
|
||||
@@ -90,7 +90,7 @@ AvConvTranscodeStreamResource::handleRequest(const Wt::Http::Request& request,
|
||||
continuation->setData(transcoder);
|
||||
}
|
||||
else
|
||||
LMS_LOG(MOD_UI, SEV_DEBUG) << "No more data!";
|
||||
LMS_LOG(UI, DEBUG) << "No more data!";
|
||||
}
|
||||
|
||||
} // namespace UserInterface
|
||||
|
||||
@@ -175,7 +175,7 @@ CoverResource::handleRequest(const Wt::Http::Request& request, Wt::Http::Respons
|
||||
}
|
||||
catch (std::invalid_argument& e)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Invalid argument: " << e.what();
|
||||
LMS_LOG(UI, ERROR) << "Invalid argument: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ Settings::Settings(Wt::WContainerWidget* parent)
|
||||
void
|
||||
Settings::handleDatabaseDirectoriesChanged()
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_NOTICE) << "Media directories have changed: requesting imediate scan";
|
||||
LMS_LOG(UI, INFO) << "Media directories have changed: requesting imediate scan";
|
||||
// On directory add or delete, request an immediate scan
|
||||
{
|
||||
Wt::Dbo::Transaction transaction(DboSession());
|
||||
|
||||
@@ -116,7 +116,7 @@ class AccountFormModel : public Wt::WFormModel
|
||||
}
|
||||
catch(Wt::Dbo::Exception& exception)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
||||
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class AudioFormModel : public Wt::WFormModel
|
||||
}
|
||||
catch(Wt::Dbo::Exception& exception)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
||||
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ class DatabaseFormModel : public Wt::WFormModel
|
||||
}
|
||||
catch(Wt::Dbo::Exception& exception)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
||||
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class FirstConnectionFormModel : public Wt::WFormModel
|
||||
// If it's the case, just do nothing
|
||||
if (!Database::User::getAll(DboSession()).empty())
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Admin user already created";
|
||||
LMS_LOG(UI, ERROR) << "Admin user already created";
|
||||
error = Wt::WString("Admin user already created!");
|
||||
return false;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class FirstConnectionFormModel : public Wt::WFormModel
|
||||
}
|
||||
catch(Wt::Dbo::Exception& exception)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
||||
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||
error = Wt::WString(exception.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class MediaDirectoryFormModel : public Wt::WFormModel
|
||||
}
|
||||
catch(Wt::Dbo::Exception& exception)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
||||
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,12 +168,12 @@ class UserFormModel : public Wt::WFormModel
|
||||
|
||||
// user may have been deleted by someone else
|
||||
if (!authUser.isValid()) {
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "user identity does not exist!";
|
||||
LMS_LOG(UI, ERROR) << "user identity does not exist!";
|
||||
return false;
|
||||
}
|
||||
else if(!user)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "User not found!";
|
||||
LMS_LOG(UI, ERROR) << "User not found!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ class UserFormModel : public Wt::WFormModel
|
||||
}
|
||||
catch(Wt::Dbo::Exception& exception)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Dbo exception: " << exception.what();
|
||||
LMS_LOG(UI, ERROR) << "Dbo exception: " << exception.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@ Users::refresh(void)
|
||||
}
|
||||
catch(Wt::Dbo::Exception& e)
|
||||
{
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Caught exception when getting userId=" << userId << ": " << e.code();
|
||||
LMS_LOG(UI, ERROR) << "Caught exception when getting userId=" << userId << ": " << e.code();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!authUser.isValid()) {
|
||||
LMS_LOG(MOD_UI, SEV_ERROR) << "Users::refresh: skipping invalid userId = " << userId;
|
||||
LMS_LOG(UI, ERROR) << "Users::refresh: skipping invalid userId = " << userId;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user