continue with cppformatter integration
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
CXX	= g++
 | 
			
		||||
CXXFLAGS	= -g -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -Wl,--no-as-needed  -I../include 
 | 
			
		||||
CXXFLAGS	= -g -march=native -Wall -Wextra -pedantic -std=c++11 -pthread -Wl,--no-as-needed  -I../include 
 | 
			
		||||
CXX_RELEASE_FLAGS = -O3 -flto
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ int main(int argc, char* argv[])
 | 
			
		||||
 | 
			
		||||
    namespace spd = spdlog;
 | 
			
		||||
    ///Create a file rotating logger with 5mb size max and 5 rotated files
 | 
			
		||||
    auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
 | 
			
		||||
    auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5, false);
 | 
			
		||||
 | 
			
		||||
    logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
 | 
			
		||||
 | 
			
		||||
    int howmany = 1000000;
 | 
			
		||||
    int threads = 10;
 | 
			
		||||
	bool auto_flush = true;
 | 
			
		||||
	bool auto_flush = false;
 | 
			
		||||
    int file_size = 30 * 1024 * 1024;
 | 
			
		||||
    int rotating_files = 5;
 | 
			
		||||
 | 
			
		||||
@@ -79,7 +79,7 @@ int main(int argc, char* argv[])
 | 
			
		||||
        cout << "*******************************************************************************\n";
 | 
			
		||||
 | 
			
		||||
        auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt", file_size, rotating_files, auto_flush);
 | 
			
		||||
        bench_mt(howmany, rotating_mt, threads);
 | 
			
		||||
		bench_mt(howmany, rotating_mt, threads);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt", auto_flush);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,16 +45,12 @@ int main(int, char* [])
 | 
			
		||||
        auto console = spd::stdout_logger_mt("console");
 | 
			
		||||
        console->info("Welcome to spdlog!") ;
 | 
			
		||||
        console->info("An info message example", "...", 1, 2, 3.5);
 | 
			
		||||
        console->info() << "Streams are supported too  " << std::setw(5) << std::setfill('0') << 1;
 | 
			
		||||
        console->info() << "Streams are supported too  " << 1;
 | 
			
		||||
 | 
			
		||||
        //Create a file rotating logger with 5mb size max and 3 rotated files
 | 
			
		||||
        auto file_logger = spd::rotating_logger_mt("file_logger", filename, 1024 * 1024 * 5, 3);
 | 
			
		||||
        file_logger->info("Log file message number", 1);
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < 100; ++i)
 | 
			
		||||
        {
 | 
			
		||||
            file_logger->info(i, "in hex is", "0x") <<  std::hex << std::uppercase << i;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        spd::set_pattern("*** [%H:%M:%S %z] [thread %t] %v ***");
 | 
			
		||||
        file_logger->info("This is another message with custom format");
 | 
			
		||||
@@ -67,10 +63,9 @@ int main(int, char* [])
 | 
			
		||||
        // Asynchronous logging is easy..
 | 
			
		||||
        // Just call spdlog::set_async_mode(max_q_size) and all created loggers from now on will be asynchronous..
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
        size_t max_q_size = 100000;
 | 
			
		||||
        spdlog::set_async_mode(max_q_size);
 | 
			
		||||
        auto async_file= spd::daily_logger_st("async_file_logger", "async_" + filename);
 | 
			
		||||
        auto async_file= spd::daily_logger_st("async_file_logger", "logs/async_log.txt");
 | 
			
		||||
        async_file->info() << "This is async log.." << "Should be very fast!";
 | 
			
		||||
 | 
			
		||||
        //
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user