mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
var names and some minor cleanups
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
// example.cpp : Simple logger example
|
||||
//
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
#include "c11log/logger.h"
|
||||
#include "c11log/sinks/async_sink.h"
|
||||
#include "c11log/sinks/file_sinks.h"
|
||||
#include "c11log/sinks/console_sinks.h"
|
||||
#include "c11log/details/log_msg.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
@@ -16,24 +14,25 @@ using namespace std::chrono;
|
||||
using namespace c11log;
|
||||
using namespace utils;
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
if(argc || argv) {};
|
||||
const unsigned int howmany = 1000000;
|
||||
|
||||
auto fsink = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, 0);
|
||||
//auto fsink = std::make_shared<sinks::simple_file_sink>("simplelog", "txt");
|
||||
auto null_sink = std::make_shared<sinks::null_sink>();
|
||||
|
||||
|
||||
logger cout_logger ("cout", {null_sink, sinks::stdout_sink()});
|
||||
|
||||
cout_logger.info() << "Hello cout logger!";
|
||||
cout_logger.info() << "Hello cout logger!";
|
||||
|
||||
logger my_logger ("my_logger", {null_sink});
|
||||
|
||||
std::string s(100, '0');
|
||||
const unsigned int howmany = 5000000;
|
||||
|
||||
auto start = system_clock::now();
|
||||
for(unsigned int i = 0; i < howmany ; i++)
|
||||
my_logger.info() << s;
|
||||
|
Reference in New Issue
Block a user