/* */ #include "Logger.h" #include #include #include "DlAbortEx.h" #include "StringFormat.h" #include "message.h" namespace aria2 { const std::string Logger::DEBUG_LABEL("DEBUG"); const std::string Logger::NOTICE_LABEL("NOTICE"); const std::string Logger::WARN_LABEL("WARN"); const std::string Logger::ERROR_LABEL("ERROR"); const std::string Logger::INFO_LABEL("INFO"); Logger::Logger():_logLevel(Logger::A2_DEBUG), _stdoutField(0) {} Logger::~Logger() { closeFile(); } void Logger::openFile(const std::string& filename) { _file.open(filename.c_str(), std::ios::app|std::ios::binary); if(!_file) { throw DL_ABORT_EX (StringFormat(EX_FILE_OPEN, filename.c_str(), strerror(errno)).str()); } } void Logger::closeFile() { if(_file.is_open()) { _file.close(); } } } // namespace aria2