diff options
Diffstat (limited to '')
-rw-r--r-- | src/base/songloading/songloading_strategy_txt.cpp | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/base/songloading/songloading_strategy_txt.cpp b/src/base/songloading/songloading_strategy_txt.cpp index a7d296a5..d3551144 100644 --- a/src/base/songloading/songloading_strategy_txt.cpp +++ b/src/base/songloading/songloading_strategy_txt.cpp @@ -36,9 +36,9 @@ namespace usdx { - log4cxx::LoggerPtr SongloadingStrategyTxt::log = - log4cxx::Logger::getLogger( - "usdx.base.songloading.SongloadingStrategyTxt"); + log4cpp::Category& SongloadingStrategyTxt::log = + log4cpp::Category::getInstance( + "usdx.base.songloading.SongloadingStrategyTxt"); SongloadingStrategyTxt::SongloadingStrategyTxt(void) { @@ -53,7 +53,8 @@ namespace usdx std::size_t pos = line.find(':'); if (line[0] != '#' || pos == std::string::npos) { - LOG4CXX_DEBUG(log, "Tried to parse invalid header line: '" << line << "'"); + log << log4cpp::Priority::DEBUG << + "Tried to parse invalid header line: '" << line << "'"; throw "Invalid header!"; } @@ -73,14 +74,16 @@ namespace usdx // line is already rtrimmed boost::trim_left(result.second); - LOG4CXX_DEBUG(log, "Found header: '" << result.first << "' with value '" << result.second << "'"); + log << log4cpp::Priority::DEBUG << "Found header: '" << + result.first << "' with value '" << result.second << "'"; return result; } Song* SongloadingStrategyTxt::load_song(Song *song) { - LOG4CXX_DEBUG(log, "Starting loading song from file: " << song->get_filename()); + log << log4cpp::Priority::DEBUG << + "Starting loading song from file: " << song->get_filename(); TextFile file(song->get_filename()); @@ -108,8 +111,10 @@ namespace usdx else if (type == 'E') { // song end if (file.stream().eof()) { - LOG4CXX_WARN(log, "End marker found in line " << line_number << - " before end of file: '" << song->get_filename() << "'."); + log << log4cpp::Priority::WARN << + "End marker found in line " << line_number << + " before end of file: '" << song->get_filename() << + "'."; } return false; @@ -124,14 +129,16 @@ namespace usdx parse_note(song, type, linestream, line_number); } else { - LOG4CXX_WARN(log, "Unknown line in song: '" << line << + log << log4cpp::Priority::WARN << + "Unknown line in song: '" << line << "' in file: " << song->get_filename() << - " at line " << line_number); + " at line " << line_number; } } catch (std::exception &e) { - LOG4CXX_WARN(log, "Error in song file at line " << - line_number << ": " << e.what()); + log << log4cpp::Priority::WARN << + "Error in song file at line " << line_number << ": " << + e.what(); } return true; @@ -145,14 +152,13 @@ namespace usdx linestream >> line_out; if (linestream.good()) { linestream >> line_in; - LOG4CXX_DEBUG(log, "Found newline in line " << - line_number << " with out of last line with " << - line_out << " and in of next line " << line_in); + log << log4cpp::Priority::DEBUG << "Found newline in line " << + line_number << " with out of last line with " << + line_out << " and in of next line " << line_in; } else { - LOG4CXX_DEBUG(log, "Found newline in line " << - line_number << " with out of last line with " << - line_out); + log << log4cpp::Priority::DEBUG << "Found newline in line " << + line_number << " with out of last line with " << line_out; } song->new_line(line_out, line_in); @@ -165,9 +171,9 @@ namespace usdx LocaleIndependentFloat new_bpm; linestream >> beat >> new_bpm; - LOG4CXX_DEBUG(log, "Found new bpm in line " << - line_number << " starting at beat: " << - beat << " and new bpm of " << new_bpm.get_value()); + log << log4cpp::Priority::DEBUG << "Found new bpm in line " << + line_number << " starting at beat: " << beat << + " and new bpm of " << new_bpm.get_value(); song->new_bpm(beat, new_bpm.get_value()); } @@ -182,9 +188,9 @@ namespace usdx getline(linestream, lyric); boost::trim_right_if(lyric, boost::is_cntrl()); - LOG4CXX_DEBUG(log, "Found lyric: '" << lyric << "' at line: " << line_number << - " at beat: " << beat << " with length: " << length << - " at height: " << height); + log << log4cpp::Priority::DEBUG << "Found lyric: '" << lyric << + "' at line: " << line_number << " at beat: " << beat << + " with length: " << length << " at height: " << height; song->new_note(type, beat, length, height, lyric); } @@ -200,7 +206,7 @@ namespace usdx boost::trim(line); boost::trim_if(line, boost::is_cntrl()); - LOG4CXX_DEBUG(log, "Line: " << line); + log << log4cpp::Priority::DEBUG << "Line: " << line; if (header && line[0] == '#') { @@ -221,7 +227,8 @@ namespace usdx } if (! notes_found) { - LOG4CXX_WARN(log, "Song: '" << filename << "' has no notes. Ignoring!"); + log << log4cpp::Priority::WARN << "Song: '" << filename << + "' has no notes. Ignoring!"; throw "No notes."; } |