/* */ #ifndef _D_LOG_FACTORY_H_ #define _D_LOG_FACTORY_H_ #include "common.h" #include #include "Logger.h" namespace aria2 { class LogFactory { private: static std::string filename_; static Logger* logger_; static bool consoleOutput_; static Logger::LEVEL logLevel_; static void openLogger(Logger* logger); public: /** * Get logger instance. Returned logger is singleton. * This function is not thread-safe. */ static Logger* getInstance(); /** * Set a filename to write log. If name is "-", log is written to * stdout. If name is "", log is not written to file. */ static void setLogFile(const std::string& name); /** * Set flag whether the log is printed in console. * If f is false, log is not printed in console. */ static void setConsoleOutput(bool f) { consoleOutput_ = f; } /** * Set log level to output. */ static void setLogLevel(Logger::LEVEL level); /** * Set log level to output by string represention of log level. * Possible values are: debug, info, notice, warn, error */ static void setLogLevel(const std::string& level); /** * Releases used resources */ static void release(); static void reconfigure(); }; } // namespace aria2 #endif // _D_LOG_FACTORY_H_