#pragma once #include #include "logger.h" #include "sinks/file_sinks.h" #include "sinks/stdout_sinks.h" // // logger creation shotcuts // namespace c11log { namespace factory { // // console loggers single/multi threaded // std::unique_ptr stdout_logger(const std::string& name = "") { auto sink = std::make_shared(); return std::unique_ptr(new logger(name, { sink })); } std::unique_ptr stdout_logger_mt(const std::string& name = "") { auto sink = std::make_shared(); return std::unique_ptr(new logger(name, { sink })); } // // simple file logger single/multi threaded // std::unique_ptr simple_file_logger(const std::string& filename, const std::string& logger_name = "" ) { auto fsink = std::make_shared(filename); return std::unique_ptr(new c11log::logger(logger_name, { fsink })); } std::unique_ptr simple_file_logger_mt(const std::string& filename, const std::string& logger_name = "") { auto fsink = std::make_shared(filename); return std::unique_ptr(new c11log::logger(logger_name, { fsink })); } // // daily file logger single/multi threaded // std::unique_ptr daily_file_logger( const std::string &filename, const std::string &extension, const std::size_t flush_every, const std::string& logger_name = "") { auto fsink = std::make_shared(filename, extension, flush_every); return std::unique_ptr(new c11log::logger(logger_name, { fsink })); } std::unique_ptr daily_file_logger_mt( const std::string &filename, const std::string &extension, const std::size_t flush_every, const std::string& logger_name = "") { auto fsink = std::make_shared(filename, extension, flush_every); return std::unique_ptr(new c11log::logger(logger_name, { fsink })); } // // rotating file logger single/multi threaded // std::unique_ptr rotating_file_logger( const std::string &filename, const std::string &extension, const std::size_t max_size, const std::size_t max_files, const std::size_t flush_every, const std::string& logger_name = "") { auto fsink = std::make_shared(filename, extension, max_size, max_files, flush_every); return std::unique_ptr(new c11log::logger(logger_name, { fsink })); } std::unique_ptr rotating_file_logger_mt( const std::string &filename, const std::string &extension, const std::size_t max_size, const std::size_t max_files, const std::size_t flush_every, const std::string& logger_name = "") { auto fsink = std::make_shared(filename, extension, max_size, max_files, flush_every); return std::unique_ptr(new c11log::logger(logger_name, { fsink })); } } // ns factory } // ns c11log