diff --git a/src/av/AvInfo.cpp b/src/av/AvInfo.cpp index 23902cd4..68390e30 100644 --- a/src/av/AvInfo.cpp +++ b/src/av/AvInfo.cpp @@ -53,7 +53,7 @@ void AvInit() /* register all the codecs */ avcodec_register_all(); av_register_all(); - LMS_LOG(MOD_AV, SEV_INFO) << "avcodec version = " << avcodec_version(); + LMS_LOG(AV, INFO) << "avcodec version = " << avcodec_version(); } @@ -79,7 +79,7 @@ MediaFile::open(void) int error = avformat_open_input(&_context, _p.string().c_str(), nullptr, nullptr); if (error < 0) { - LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot open '" << _p.string() << "', avformat_open_input returned " << averror_to_string(error); + LMS_LOG(AV, ERROR) << "Cannot open '" << _p.string() << "', avformat_open_input returned " << averror_to_string(error); return false; } @@ -95,7 +95,7 @@ MediaFile::scan(void) int error = avformat_find_stream_info(_context, nullptr); if (error < 0) { - LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot find stream information: '" << averror_to_string(error); + LMS_LOG(AV, ERROR) << "Cannot find stream information: '" << averror_to_string(error); return false; } @@ -171,7 +171,7 @@ MediaFile::getStreams(Stream::Type type) const if (avstream->codec == nullptr) { - LMS_LOG(MOD_AV, SEV_ERROR) << "Skipping stream " << i << " since no codec is set"; + LMS_LOG(AV, ERROR) << "Skipping stream " << i << " since no codec is set"; continue; } @@ -226,7 +226,7 @@ MediaFile::getBestStreamId(Stream::Type type) const 0); if (res < 0) { - LMS_LOG(MOD_AV, SEV_ERROR) << "Cannot find best stream for type " << streamType_to_string(type); + LMS_LOG(AV, ERROR) << "Cannot find best stream for type " << streamType_to_string(type); return -1; } @@ -273,7 +273,7 @@ MediaFile::getAttachedPictures(std::size_t nbMaxPictures) const if (avstream->codec == nullptr) { - LMS_LOG(MOD_AV, SEV_ERROR) << "Skipping stream " << i << " since no codec is set"; + LMS_LOG(AV, ERROR) << "Skipping stream " << i << " since no codec is set"; continue; } @@ -287,7 +287,7 @@ MediaFile::getAttachedPictures(std::size_t nbMaxPictures) const else { picture.mimeType = "application/octet-stream"; - LMS_LOG(MOD_AV, SEV_ERROR) << "CODEC ID " << avstream->codec->codec_id << " not handled in mime type conversion"; + LMS_LOG(AV, ERROR) << "CODEC ID " << avstream->codec->codec_id << " not handled in mime type conversion"; } AVPacket pkt = avstream->attached_pic; diff --git a/src/av/AvTranscoder.cpp b/src/av/AvTranscoder.cpp index 41353ed6..a4130a20 100644 --- a/src/av/AvTranscoder.cpp +++ b/src/av/AvTranscoder.cpp @@ -66,7 +66,7 @@ Transcoder::init() } if (!_avConvPath.empty()) - LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Using transcoder " << _avConvPath; + LMS_LOG(TRANSCODE, INFO) << "Using transcoder " << _avConvPath; else throw std::runtime_error("Cannot find any transcoder binary!"); } @@ -94,7 +94,7 @@ Transcoder::start() else if (!boost::filesystem::is_regular( _filePath) ) return false; - LMS_LOG(MOD_TRANSCODE, SEV_INFO) << "Transcoding file '" << _filePath << "'"; + LMS_LOG(TRANSCODE, INFO) << "Transcoding file '" << _filePath << "'"; // Launch a process to handle the conversion boost::iostreams::file_descriptor_sink sink(_outputPipe.sink, boost::iostreams::close_handle); @@ -157,7 +157,7 @@ Transcoder::start() } oss << " -"; // output to stdout - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Executing '" << oss.str() << "'"; + LMS_LOG(TRANSCODE, DEBUG) << "Executing '" << oss.str() << "'"; // make sure only one thread is executing this part of code // See boost process FAQ @@ -191,7 +191,7 @@ Transcoder::process(std::vector& output, std::size_t maxSize) } if (!_in || _in.fail() || _in.eof()) { - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Transcode complete!"; + LMS_LOG(TRANSCODE, DEBUG) << "Transcode complete!"; waitChild(); _isComplete = true; @@ -201,7 +201,7 @@ Transcoder::process(std::vector& output, std::size_t maxSize) Transcoder::~Transcoder() { - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "~Transcoder called!"; + LMS_LOG(TRANSCODE, DEBUG) << "~Transcoder called!"; if (_in.eof()) waitChild(); @@ -216,12 +216,12 @@ Transcoder::waitChild() { boost::system::error_code ec; - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Waiting for child..."; + LMS_LOG(TRANSCODE, DEBUG) << "Waiting for child..."; boost::process::wait_for_exit(*_child, ec); - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Waiting for child: OK"; + LMS_LOG(TRANSCODE, DEBUG) << "Waiting for child: OK"; if (ec) - LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Transcoder::waitChild: error: " << ec.message(); + LMS_LOG(TRANSCODE, ERROR) << "Transcoder::waitChild: error: " << ec.message(); _child.reset(); } @@ -234,13 +234,13 @@ Transcoder::killChild() { boost::system::error_code ec; - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Killing child! pid = " << _child->pid; + LMS_LOG(TRANSCODE, DEBUG) << "Killing child! pid = " << _child->pid; boost::process::terminate(*_child, ec); - LMS_LOG(MOD_TRANSCODE, SEV_DEBUG) << "Killing child DONE"; + LMS_LOG(TRANSCODE, DEBUG) << "Killing child DONE"; // If an error occured, force kill the child if (ec) - LMS_LOG(MOD_TRANSCODE, SEV_ERROR) << "Transcoder::killChild: error: " << ec.message(); + LMS_LOG(TRANSCODE, ERROR) << "Transcoder::killChild: error: " << ec.message(); _child.reset(); } diff --git a/src/cover/CoverArt.cpp b/src/cover/CoverArt.cpp index 35b2c991..597c0053 100644 --- a/src/cover/CoverArt.cpp +++ b/src/cover/CoverArt.cpp @@ -71,7 +71,7 @@ CoverArt::scale(std::size_t size) } catch(std::exception& e) { - LMS_LOG(MOD_COVER, SEV_ERROR) << "Caught exception: " << e.what(); + LMS_LOG(COVER, ERROR) << "Caught exception: " << e.what(); } return res; diff --git a/src/cover/CoverArtGrabber.cpp b/src/cover/CoverArtGrabber.cpp index bbfe486e..eaa9db3c 100644 --- a/src/cover/CoverArtGrabber.cpp +++ b/src/cover/CoverArtGrabber.cpp @@ -112,7 +112,7 @@ Grabber::getCoverPaths(const boost::filesystem::path& directoryPath, std::size_t if (boost::filesystem::file_size(path) > _maxFileSize) { - LMS_LOG(MOD_COVER, SEV_INFO) << "Cover file '" << path << " is too big (" << boost::filesystem::file_size(path) << "), limit is " << _maxFileSize; + LMS_LOG(COVER, INFO) << "Cover file '" << path << " is too big (" << boost::filesystem::file_size(path) << "), limit is " << _maxFileSize; continue; } diff --git a/src/database-updater/Checksum.cpp b/src/database-updater/Checksum.cpp index f4c0dec6..ad52914b 100644 --- a/src/database-updater/Checksum.cpp +++ b/src/database-updater/Checksum.cpp @@ -47,7 +47,7 @@ void computeCrc(const boost::filesystem::path& p, std::vector& cr } else { - LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Failed to open file '" << p << "'"; + LMS_LOG(DBUPDATER, ERROR) << "Failed to open file '" << p << "'"; throw std::runtime_error("Failed to open file '" + p.string() + "'" ); } diff --git a/src/database-updater/DatabaseUpdater.cpp b/src/database-updater/DatabaseUpdater.cpp index 34ae8ba4..524e09d7 100644 --- a/src/database-updater/DatabaseUpdater.cpp +++ b/src/database-updater/DatabaseUpdater.cpp @@ -154,7 +154,7 @@ Updater::processNextJob(void) MediaDirectorySettings::pointer settings = MediaDirectorySettings::get(_db.getSession()); if (settings->getManualScanRequested()) { - LMS_LOG(MOD_DBUPDATER, SEV_NOTICE) << "Manual scan requested!"; + LMS_LOG(DBUPDATER, INFO) << "Manual scan requested!"; scheduleScan( boost::posix_time::seconds(0) ); } else @@ -197,7 +197,7 @@ Updater::processNextJob(void) void Updater::scheduleScan( boost::posix_time::time_duration duration) { - LMS_LOG(MOD_DBUPDATER, SEV_NOTICE) << "Scheduling next scan in " << duration; + LMS_LOG(DBUPDATER, INFO) << "Scheduling next scan in " << duration; _scheduleTimer.expires_from_now(duration); _scheduleTimer.async_wait( boost::bind( &Updater::process, this, boost::asio::placeholders::error) ); } @@ -205,7 +205,7 @@ Updater::scheduleScan( boost::posix_time::time_duration duration) void Updater::scheduleScan( boost::posix_time::ptime time) { - LMS_LOG(MOD_DBUPDATER, SEV_NOTICE) << "Scheduling next scan at " << time; + LMS_LOG(DBUPDATER, INFO) << "Scheduling next scan at " << time; _scheduleTimer.expires_at(time); _scheduleTimer.async_wait( boost::bind( &Updater::process, this, boost::asio::placeholders::error) ); } @@ -230,12 +230,12 @@ Updater::process(boost::system::error_code err) for (RootDirectory rootDirectory : rootDirectories) { - LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Processing root directory '" << rootDirectory.path << "'..."; + LMS_LOG(DBUPDATER, INFO) << "Processing root directory '" << rootDirectory.path << "'..."; processRootDirectory(rootDirectory, stats); - LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Processing root directory '" << rootDirectory.path << "' DONE"; + LMS_LOG(DBUPDATER, INFO) << "Processing root directory '" << rootDirectory.path << "' DONE"; } - LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Scan complete. Changes = " << stats.nbChanges() << ", Errors = " << stats.nbScanErrors; + LMS_LOG(DBUPDATER, INFO) << "Scan complete. Changes = " << stats.nbChanges() << ", Errors = " << stats.nbScanErrors; // Update database stats boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); @@ -396,7 +396,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats) if (items.find(MetaData::Type::AudioStreams) == items.end() || boost::any_cast >(items[MetaData::Type::AudioStreams]).empty()) { - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Skipped '" << file << "' (no audio stream found)"; + LMS_LOG(DBUPDATER, DEBUG) << "Skipped '" << file << "' (no audio stream found)"; // If Track exists here, delete it! if (track) { @@ -408,7 +408,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats) if (items.find(MetaData::Type::Duration) == items.end() || boost::any_cast(items[MetaData::Type::Duration]).total_seconds() <= 0) { - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Skipped '" << file << "' (no duration or duration <= 0)"; + LMS_LOG(DBUPDATER, DEBUG) << "Skipped '" << file << "' (no duration or duration <= 0)"; // If Track exists here, delete it! if (track) { @@ -481,12 +481,12 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats) { // Create a new song track = Track::create(_db.getSession(), file); - LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Adding '" << file << "'"; + LMS_LOG(DBUPDATER, INFO) << "Adding '" << file << "'"; stats.nbAdded++; } else { - LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Updating '" << file << "'"; + LMS_LOG(DBUPDATER, INFO) << "Updating '" << file << "'"; stats.nbModified++; } @@ -547,7 +547,7 @@ Updater::processAudioFile( const boost::filesystem::path& file, Stats& stats) } catch( std::exception& e ) { - LMS_LOG(MOD_DBUPDATER, SEV_ERROR) << "Exception while parsing audio file : '" << file << "': '" << e.what() << "' => skipping!"; + LMS_LOG(DBUPDATER, ERROR) << "Exception while parsing audio file : '" << file << "': '" << e.what() << "' => skipping!"; stats.nbRemoved++; } } @@ -602,7 +602,7 @@ Updater::checkFile(const boost::filesystem::path& p, const std::vector rootDirs = getRootDirectoriesByType(_db.getSession(), Database::MediaDirectory::Audio); - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking tracks..."; + LMS_LOG(DBUPDATER, DEBUG) << "Checking tracks..."; auto tracks = Track::getAll(_db.getSession()); for (auto track : tracks) { @@ -661,45 +661,45 @@ Updater::checkAudioFiles( Stats& stats ) } // Now process orphan Genre (no track) - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking Genres..."; + LMS_LOG(DBUPDATER, DEBUG) << "Checking Genres..."; auto genres = Genre::getAll(_db.getSession()); for (auto genre : genres) { if (genre->getTracks().size() == 0) { - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Removing orphan genre '" << genre->getName() << "'"; + LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan genre '" << genre->getName() << "'"; genre.remove(); } } - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking artists..."; + LMS_LOG(DBUPDATER, DEBUG) << "Checking artists..."; auto artists = Artist::getAllOrphans(_db.getSession()); for (auto artist : artists) { - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Removing orphan artist '" << artist->getName() << "'"; + LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan artist '" << artist->getName() << "'"; artist.remove(); } - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking releases..."; + LMS_LOG(DBUPDATER, DEBUG) << "Checking releases..."; auto releases = Release::getAllOrphans(_db.getSession()); for (auto release : releases) { - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Removing orphan release '" << release->getName() << "'"; + LMS_LOG(DBUPDATER, DEBUG) << "Removing orphan release '" << release->getName() << "'"; release.remove(); } - LMS_LOG(MOD_DBUPDATER, SEV_INFO) << "Check audio files done!"; + LMS_LOG(DBUPDATER, INFO) << "Check audio files done!"; } void Updater::checkVideoFiles( Stats& stats ) { - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking video files..."; + LMS_LOG(DBUPDATER, DEBUG) << "Checking video files..."; Wt::Dbo::Transaction transaction(_db.getSession()); std::vector rootDirs = getRootDirectoriesByType(_db.getSession(), Database::MediaDirectory::Video); - LMS_LOG(MOD_DBUPDATER, SEV_DEBUG) << "Checking videos..."; + LMS_LOG(DBUPDATER, DEBUG) << "Checking videos..."; typedef Wt::Dbo::collection< Wt::Dbo::ptr