diff --git a/example/bench.cpp b/example/bench.cpp index abbd379a..f0c819da 100644 --- a/example/bench.cpp +++ b/example/bench.cpp @@ -8,14 +8,12 @@ #include "c11log/sinks/null_sink.h" #include "utils.h" -using std::cout; -using std::endl; using namespace std::chrono; using namespace c11log; using namespace utils; -int main_(int argc, char* argv[]) +int main(int argc, char* argv[]) { const unsigned int howmany = argc <= 1 ? 500000 : atoi(argv[1]); @@ -26,9 +24,9 @@ int main_(int argc, char* argv[]) cout_logger.info() << "Hello logger " << 1234; auto nullsink = std::make_shared(); - //auto rotating = std::make_shared("myrotating", "txt", 1024 * 1024 * 5, 5, 100); + auto rotating = std::make_shared("myrotating", "txt", 1024 * 1024 * 5, 5, 1); - logger my_logger("my_logger", { nullsink }); + logger my_logger("my_logger", { rotating }); auto start = system_clock::now(); for (unsigned int i = 1; i <= howmany; ++i) diff --git a/example/example.cpp b/example/example.cpp index c00f868e..55b17ed8 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -8,28 +8,21 @@ #include "c11log/sinks/stdout_sinks.h" #include "c11log/sinks/file_sinks.h" using namespace std; +using namespace c11log; -int main(int, char* []) + +details::fast_oss f(const std::string& what) +{ + details::fast_oss oss; + oss << what; + return oss; +} +int main_(int, char* []) { - auto console = c11log::factory::stdout_logger(); - auto file = c11log::factory::simple_file_logger("log.txt"); - auto rotating= c11log::factory::rotating_file_logger("myrotating", "txt", 1024*1024*5, 5, 1); - auto daily = c11log::factory::daily_file_logger("dailylog", "txt", 1, "daily_logger"); + auto foss = f("test2"); + foss.str(); - - //console->info() << "This is variadic ", " func, ", 123 << " YES"; - FFLOG_TRACE(console, "This is ", 1); - - - file->info("Hello file log"); - rotating->info("Hello rotating log"); - daily->info("Hello daily log"); - - //multi sink logger: file + console - auto sink1= std::make_shared(); - auto sink2 = std::make_shared("rotating", "txt"); - c11log::logger combined("combined", { sink1, sink2 }); return 0; }