astyle
This commit is contained in:
		
							parent
							
								
									d2a367fa7c
								
							
						
					
					
						commit
						3afabcd17e
					
				| @ -56,8 +56,8 @@ int main(int, char*[]) | ||||
| 
 | ||||
|         // Create a daily logger - a new file is created every day on 2:30am
 | ||||
|         auto daily_logger = spd::daily_logger_mt("daily_logger", "logs/daily", 2, 30); | ||||
| 		// trigger flush if the log severity is error or higher
 | ||||
| 		daily_logger->flush_on(spd::level::err); | ||||
|         // trigger flush if the log severity is error or higher
 | ||||
|         daily_logger->flush_on(spd::level::err); | ||||
|         daily_logger->info(123.44); | ||||
| 
 | ||||
|         // Customize msg format for all messages
 | ||||
|  | ||||
| @ -75,8 +75,8 @@ inline void spdlog::async_logger::_sink_it(details::log_msg& msg) | ||||
|     try | ||||
|     { | ||||
|         _async_log_helper->log(msg); | ||||
| 		if (_should_flush_on(msg)) | ||||
| 			flush(); | ||||
|         if (_should_flush_on(msg)) | ||||
|             flush(); | ||||
|     } | ||||
|     catch (const std::exception &ex) | ||||
|     { | ||||
|  | ||||
| @ -283,6 +283,6 @@ inline void spdlog::logger::_default_err_handler(const std::string &msg) | ||||
| 
 | ||||
| inline bool spdlog::logger::_should_flush_on(const details::log_msg &msg) | ||||
| { | ||||
| 	const auto flush_level = _flush_level.load(std::memory_order_relaxed); | ||||
| 	return (msg.level >= flush_level) && (msg.level != level::off); | ||||
|     const auto flush_level = _flush_level.load(std::memory_order_relaxed); | ||||
|     return (msg.level >= flush_level) && (msg.level != level::off); | ||||
| } | ||||
|  | ||||
| @ -76,8 +76,8 @@ protected: | ||||
|     // default error handler: print the error to stderr with the max rate of 1 message/minute
 | ||||
|     virtual void _default_err_handler(const std::string &msg); | ||||
| 
 | ||||
| 	// return true if the given message level should trigger a flush
 | ||||
| 	bool _should_flush_on(const details::log_msg&); | ||||
|     // return true if the given message level should trigger a flush
 | ||||
|     bool _should_flush_on(const details::log_msg&); | ||||
| 
 | ||||
|     const std::string _name; | ||||
|     std::vector<sink_ptr> _sinks; | ||||
|  | ||||
| @ -26,7 +26,7 @@ TEST_CASE("rotating_file_logger1", "[rotating_logger]]") | ||||
|     prepare_logdir(); | ||||
|     std::string basename = "logs/rotating_log"; | ||||
|     auto logger = spdlog::rotating_logger_mt("logger", basename, 1024, 0); | ||||
| 	logger->flush_on(spdlog::level::info); | ||||
|     logger->flush_on(spdlog::level::info); | ||||
|     for (int i = 0; i < 10; ++i) | ||||
|         logger->info("Test message {}", i); | ||||
| 
 | ||||
| @ -70,7 +70,7 @@ TEST_CASE("daily_logger", "[daily_logger]]") | ||||
|     w.write("{}_{:04d}-{:02d}-{:02d}_{:02d}-{:02d}.txt", basename, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min); | ||||
| 
 | ||||
|     auto logger = spdlog::daily_logger_mt("logger", basename, 0, 0); | ||||
| 	logger->flush_on(spdlog::level::info); | ||||
|     logger->flush_on(spdlog::level::info); | ||||
|     for (int i = 0; i < 10; ++i) | ||||
|         logger->info("Test message {}", i); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user