Merge pull request #2245 from daverigby/level_enum_fwd
Allow forward-declaration of level_enum
This commit is contained in:
		@@ -208,7 +208,7 @@ using level_t = std::atomic<int>;
 | 
			
		||||
 | 
			
		||||
// Log level enum
 | 
			
		||||
namespace level {
 | 
			
		||||
enum level_enum
 | 
			
		||||
enum level_enum : int
 | 
			
		||||
{
 | 
			
		||||
    trace = SPDLOG_LEVEL_TRACE,
 | 
			
		||||
    debug = SPDLOG_LEVEL_DEBUG,
 | 
			
		||||
 
 | 
			
		||||
@@ -11,4 +11,8 @@ namespace sinks {
 | 
			
		||||
class sink;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace level {
 | 
			
		||||
enum level_enum : int;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace spdlog
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ template<typename ConsoleMutex>
 | 
			
		||||
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::set_color(level::level_enum color_level, string_view_t color)
 | 
			
		||||
{
 | 
			
		||||
    std::lock_guard<mutex_t> lock(mutex_);
 | 
			
		||||
    colors_[color_level] = to_string_(color);
 | 
			
		||||
    colors_[static_cast<size_t>(color_level)] = to_string_(color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename ConsoleMutex>
 | 
			
		||||
@@ -52,7 +52,7 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::log(const details::log_msg &msg
 | 
			
		||||
        // before color range
 | 
			
		||||
        print_range_(formatted, 0, msg.color_range_start);
 | 
			
		||||
        // in color range
 | 
			
		||||
        print_ccode_(colors_[msg.level]);
 | 
			
		||||
        print_ccode_(colors_[static_cast<size_t>(msg.level)]);
 | 
			
		||||
        print_range_(formatted, msg.color_range_start, msg.color_range_end);
 | 
			
		||||
        print_ccode_(reset);
 | 
			
		||||
        // after color range
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user