mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 10:31:34 +08:00
Merge pull request #2245 from daverigby/level_enum_fwd
Allow forward-declaration of level_enum
This commit is contained in:
commit
4cfdc8c5c8
@ -208,7 +208,7 @@ using level_t = std::atomic<int>;
|
|||||||
|
|
||||||
// Log level enum
|
// Log level enum
|
||||||
namespace level {
|
namespace level {
|
||||||
enum level_enum
|
enum level_enum : int
|
||||||
{
|
{
|
||||||
trace = SPDLOG_LEVEL_TRACE,
|
trace = SPDLOG_LEVEL_TRACE,
|
||||||
debug = SPDLOG_LEVEL_DEBUG,
|
debug = SPDLOG_LEVEL_DEBUG,
|
||||||
|
@ -11,4 +11,8 @@ namespace sinks {
|
|||||||
class sink;
|
class sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace level {
|
||||||
|
enum level_enum : int;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace spdlog
|
} // 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)
|
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::set_color(level::level_enum color_level, string_view_t color)
|
||||||
{
|
{
|
||||||
std::lock_guard<mutex_t> lock(mutex_);
|
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>
|
template<typename ConsoleMutex>
|
||||||
@ -52,7 +52,7 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::log(const details::log_msg &msg
|
|||||||
// before color range
|
// before color range
|
||||||
print_range_(formatted, 0, msg.color_range_start);
|
print_range_(formatted, 0, msg.color_range_start);
|
||||||
// in color range
|
// 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_range_(formatted, msg.color_range_start, msg.color_range_end);
|
||||||
print_ccode_(reset);
|
print_ccode_(reset);
|
||||||
// after color range
|
// after color range
|
||||||
|
Loading…
Reference in New Issue
Block a user