mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 15:50:05 +00:00 
			
		
		
		
	Initial setup for spdlog
This commit is contained in:
		
							parent
							
								
									7aef98b002
								
							
						
					
					
						commit
						20b8c75234
					
				
					 5 changed files with 67 additions and 0 deletions
				
			
		
							
								
								
									
										37
									
								
								wxdata/source/scwx/util/logger.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								wxdata/source/scwx/util/logger.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| #include <scwx/util/logger.hpp> | ||||
| 
 | ||||
| #include <mutex> | ||||
| 
 | ||||
| #include <spdlog/spdlog.h> | ||||
| #include <spdlog/sinks/stdout_color_sinks.h> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace util | ||||
| { | ||||
| namespace Logger | ||||
| { | ||||
| 
 | ||||
| void Initialize() | ||||
| { | ||||
|    spdlog::set_pattern("[%Y-%m-%d %T.%e] [%t] [%^%l%$] [%n] %v"); | ||||
| } | ||||
| 
 | ||||
| std::shared_ptr<spdlog::logger> Create(const std::string& name) | ||||
| { | ||||
|    // Create a shared sink
 | ||||
|    static auto sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>(); | ||||
| 
 | ||||
|    // Create the logger
 | ||||
|    std::shared_ptr<spdlog::logger> logger = | ||||
|       std::make_shared<spdlog::logger>(name, sink); | ||||
| 
 | ||||
|    // Register the logger, so it can be retrieved later using spdlog::get()
 | ||||
|    spdlog::register_logger(logger); | ||||
| 
 | ||||
|    return logger; | ||||
| } | ||||
| 
 | ||||
| } // namespace Logger
 | ||||
| } // namespace util
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat