// // file_logger.cpp // logger // // Created by Sam Jaffe on 10/2/15. // // #include "logger.hpp" #include "default_logger_binding.hpp" #include namespace logging { class file_logger : public logger_impl { public: static std::unique_ptr create(logging::properties const&); file_logger(const std::string& fname); void write(log_level level, std::string const& msg) override; void flush() override; private: std::ofstream out_; }; std::unique_ptr file_logger::create(properties const&) { return std::unique_ptr(); // TODO } file_logger::file_logger(const std::string& fname) : out_(fname) {} void file_logger::write(log_level level, std::string const& msg) { out_ << msg; } void file_logger::flush() { out_.flush(); } namespace { bool _ = default_logger_impl::register_impl("File", file_logger::create); } }