fixes
This commit is contained in:
parent
a6d1ea77ee
commit
9d687d1634
@ -20,29 +20,20 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
if(argc || argv) {};
|
||||
|
||||
|
||||
auto fsink = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, seconds(1));
|
||||
//auto &my_logger = get_logger("example");
|
||||
//auto fsink = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, seconds(1));
|
||||
auto null_sink = std::make_shared<sinks::null_sink>();
|
||||
//auto async = std::make_shared<sinks::async_sink>(1000);
|
||||
//my_logger.add_sink(fsink);
|
||||
//my_logger.add_sink(null_sink);
|
||||
|
||||
|
||||
|
||||
logger cout_logger (
|
||||
"cout",
|
||||
{null_sink, sinks::stdout_sink(), fsink});
|
||||
logger cout_logger ("cout", {null_sink, sinks::stdout_sink()});
|
||||
|
||||
cout_logger.info() << "Hello cout logger!";
|
||||
|
||||
logger log2 {sinks::stdout_sink()};
|
||||
log2.error() << "Cool shit" << "!!!";
|
||||
return 0;
|
||||
/*
|
||||
|
||||
logger my_logger ("my_logger", {null_sink});
|
||||
|
||||
auto start = system_clock::now();
|
||||
|
||||
const unsigned int howmany = 5000000;
|
||||
const unsigned int howmany = 10000000;
|
||||
for(unsigned int i = 0; i < howmany ; i++)
|
||||
my_logger.info() << "Hello logger " << i;
|
||||
|
||||
@ -55,7 +46,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
return 0;
|
||||
*/
|
||||
|
||||
/*
|
||||
if(argc !=3) {
|
||||
std::cerr << "Usage: " << argv[0] << " qsize, threads" << std::endl;
|
||||
|
@ -33,21 +33,9 @@ public:
|
||||
using sinks_vector_t = std::vector<sink_ptr>;
|
||||
using sinks_init_list = std::initializer_list<sink_ptr>;
|
||||
|
||||
|
||||
logger(const std::string& name, formatter_ptr f, sinks_init_list sinks_list) :
|
||||
_logger_name(name),
|
||||
_formatter(f),
|
||||
_sinks(sinks_list) {
|
||||
//Seems that vs2013 doesnt support atomic member initialization in ctor, so its done here
|
||||
_atomic_level = level::INFO;
|
||||
}
|
||||
|
||||
logger(const std::string& name, sinks_init_list sinks_list) :
|
||||
logger(name, std::make_shared<formatters::default_formatter>(), sinks_list) {}
|
||||
|
||||
|
||||
logger(sinks_init_list sinks_list) :
|
||||
logger("", std::make_shared<formatters::default_formatter>(), sinks_list) {}
|
||||
logger(const std::string& name, formatter_ptr f, sinks_init_list sinks_list);
|
||||
logger(const std::string& name, sinks_init_list sinks_list);
|
||||
logger(sinks_init_list sinks_list);
|
||||
|
||||
|
||||
~logger() = default;
|
||||
@ -89,9 +77,27 @@ logger& get_logger(const std::string& name);
|
||||
|
||||
|
||||
//
|
||||
// Logger inline impl
|
||||
// Logger inline implementation
|
||||
//
|
||||
#include "details/line_logger.h"
|
||||
|
||||
|
||||
inline c11log::logger::logger(const std::string& name, formatter_ptr f, sinks_init_list sinks_list) :
|
||||
_logger_name(name),
|
||||
_formatter(f),
|
||||
_sinks(sinks_list)
|
||||
{
|
||||
//Seems that vs2013 doesnt support atomic member initialization in ctor, so its done here
|
||||
_atomic_level = level::INFO;
|
||||
}
|
||||
|
||||
inline c11log::logger::logger(const std::string& name, sinks_init_list sinks_list) :
|
||||
logger(name, std::make_shared<formatters::default_formatter>(), sinks_list) {}
|
||||
|
||||
inline c11log::logger::logger(sinks_init_list sinks_list) :
|
||||
logger("", std::make_shared<formatters::default_formatter>(), sinks_list) {}
|
||||
|
||||
|
||||
inline c11log::details::line_logger c11log::logger::log(c11log::level::level_enum msg_level)
|
||||
{
|
||||
return details::line_logger(this, msg_level, msg_level >= _atomic_level);
|
||||
|
Loading…
Reference in New Issue
Block a user