astyle
This commit is contained in:
		
							parent
							
								
									8d25324444
								
							
						
					
					
						commit
						73b31e4d10
					
				| @ -19,7 +19,7 @@ int main(int argc, char* argv[]) | |||||||
| 
 | 
 | ||||||
|     g2LogWorker g2log(argv[0], "logs"); |     g2LogWorker g2log(argv[0], "logs"); | ||||||
|     g2::initializeLogging(&g2log); |     g2::initializeLogging(&g2log); | ||||||
|        | 
 | ||||||
| 
 | 
 | ||||||
|     std::atomic<int > msg_counter {0}; |     std::atomic<int > msg_counter {0}; | ||||||
|     vector<thread> threads; |     vector<thread> threads; | ||||||
|  | |||||||
| @ -5,10 +5,10 @@ | |||||||
| int main(int, char* argv[]) | int main(int, char* argv[]) | ||||||
| { | { | ||||||
|     int howmany = 1000000; |     int howmany = 1000000; | ||||||
| 	 | 
 | ||||||
| 	g2LogWorker g2log(argv[0], "logs"); |     g2LogWorker g2log(argv[0], "logs"); | ||||||
|     g2::initializeLogging(&g2log); |     g2::initializeLogging(&g2log); | ||||||
|        | 
 | ||||||
|     for(int i  = 0 ; i < howmany; ++i) |     for(int i  = 0 ; i < howmany; ++i) | ||||||
|         LOG(INFO) << "g2log message # " << i << ": This is some text for your pleasure"; |         LOG(INFO) << "g2log message # " << i << ": This is some text for your pleasure"; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -6,13 +6,13 @@ int main(int, char* []) | |||||||
| { | { | ||||||
|     int howmany = 1000000; |     int howmany = 1000000; | ||||||
|     namespace spd = spdlog; |     namespace spd = spdlog; | ||||||
|    	spd::set_async_mode(2500, std::chrono::seconds(0)); |     spd::set_async_mode(2500, std::chrono::seconds(0)); | ||||||
|     ///Create a file rotating logger with 5mb size max and 3 rotated files
 |     ///Create a file rotating logger with 5mb size max and 3 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); | ||||||
| 
 | 
 | ||||||
|     logger->set_pattern("[%Y-%b-%d %T.%e]: %v"); |     logger->set_pattern("[%Y-%b-%d %T.%e]: %v"); | ||||||
|     for(int i  = 0 ; i < howmany; ++i) |     for(int i  = 0 ; i < howmany; ++i) | ||||||
|         logger->info() << "spdlog message #" << i << ": This is some text for your pleasure"; |         logger->info() << "spdlog message #" << i << ": This is some text for your pleasure"; | ||||||
|     spd::stop();      |     spd::stop(); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ int main(int argc, char* argv[]) | |||||||
|     int howmany = 1000000; |     int howmany = 1000000; | ||||||
| 
 | 
 | ||||||
|     namespace spd = spdlog; |     namespace spd = spdlog; | ||||||
| 	spd::set_async_mode(2500, std::chrono::seconds(0)); |     spd::set_async_mode(2500, std::chrono::seconds(0)); | ||||||
|     ///Create a file rotating logger with 5mb size max and 3 rotated files
 |     ///Create a file rotating logger with 5mb size max and 3 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); | ||||||
| 
 | 
 | ||||||
| @ -45,6 +45,6 @@ int main(int argc, char* argv[]) | |||||||
|         t.join(); |         t.join(); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| 	spd::stop();      |     spd::stop(); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  | |||||||
| @ -52,7 +52,7 @@ int main(int argc, char* argv[]) | |||||||
| 
 | 
 | ||||||
|     int howmany = 1000000; |     int howmany = 1000000; | ||||||
|     int threads = 10; |     int threads = 10; | ||||||
| 	bool auto_flush = false; |     bool auto_flush = false; | ||||||
|     int file_size = 30 * 1024 * 1024; |     int file_size = 30 * 1024 * 1024; | ||||||
|     int rotating_files = 5; |     int rotating_files = 5; | ||||||
| 
 | 
 | ||||||
| @ -79,22 +79,22 @@ int main(int argc, char* argv[]) | |||||||
|         cout << "*******************************************************************************\n"; |         cout << "*******************************************************************************\n"; | ||||||
| 
 | 
 | ||||||
|         auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt", file_size, rotating_files, auto_flush); |         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); |         auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt", auto_flush); | ||||||
|         bench_mt(howmany, daily_mt, threads); |         bench_mt(howmany, daily_mt, threads); | ||||||
|         bench(howmany, spdlog::create<null_sink_st>("null_mt")); |         bench(howmany, spdlog::create<null_sink_st>("null_mt")); | ||||||
| 		 | 
 | ||||||
|         cout << "\n*******************************************************************************\n"; |         cout << "\n*******************************************************************************\n"; | ||||||
|         cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, auto_flush=" << auto_flush << endl; |         cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, auto_flush=" << auto_flush << endl; | ||||||
| 	    cout << "*******************************************************************************\n"; |         cout << "*******************************************************************************\n"; | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 		 |  | ||||||
|         spdlog::set_async_mode(2500); |         spdlog::set_async_mode(2500); | ||||||
|         auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", auto_flush); |         auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", auto_flush); | ||||||
| 		bench_mt(howmany, daily_st_async, threads); |         bench_mt(howmany, daily_st_async, threads); | ||||||
| 	 | 
 | ||||||
|         spdlog::stop(); |         spdlog::stop(); | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -61,8 +61,10 @@ should not be interpreted as representing official policies, either expressed or | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #include <atomic> | #include <atomic> | ||||||
| namespace spdlog { | namespace spdlog | ||||||
| namespace details { | { | ||||||
|  | namespace details | ||||||
|  | { | ||||||
| template<typename T> | template<typename T> | ||||||
| class mpsc_q | class mpsc_q | ||||||
| { | { | ||||||
|  | |||||||
| @ -429,7 +429,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag) | |||||||
| { | { | ||||||
|     switch (flag) |     switch (flag) | ||||||
|     { |     { | ||||||
|     // logger name
 |         // logger name
 | ||||||
|     case 'n': |     case 'n': | ||||||
|         _formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter())); |         _formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter())); | ||||||
|         break; |         break; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user