/* */ #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; public: /** * Get logger instance. Returned logger is singleton. * This function is not thread-safe. */ static Logger* getInstance(); /** * Set a filename to write log. */ static void setLogFile(const std::string& name) { filename = 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(); }; } // namespace aria2 #endif // _D_LOG_FACTORY_H_