mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
use constexpr for colors in ansicolor_sink
This commit is contained in:
parent
5683d16b36
commit
e63d110baa
@ -34,7 +34,7 @@ template<typename ConsoleMutex>
|
||||
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::set_color(log_level color_level, string_view_t color)
|
||||
{
|
||||
std::lock_guard<mutex_t> lock(mutex_);
|
||||
colors_.at(static_cast<size_t>(color_level)) = to_string_(color);
|
||||
colors_.at(to_size_t(color_level)) = to_string_(color);
|
||||
}
|
||||
|
||||
template<typename ConsoleMutex>
|
||||
|
@ -45,39 +45,39 @@ public:
|
||||
void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) override;
|
||||
|
||||
// Formatting codes
|
||||
const string_view_t reset = "\033[m";
|
||||
const string_view_t bold = "\033[1m";
|
||||
const string_view_t dark = "\033[2m";
|
||||
const string_view_t underline = "\033[4m";
|
||||
const string_view_t blink = "\033[5m";
|
||||
const string_view_t reverse = "\033[7m";
|
||||
const string_view_t concealed = "\033[8m";
|
||||
const string_view_t clear_line = "\033[K";
|
||||
static constexpr string_view_t reset = "\033[m";
|
||||
static constexpr string_view_t bold = "\033[1m";
|
||||
static constexpr string_view_t dark = "\033[2m";
|
||||
static constexpr string_view_t underline = "\033[4m";
|
||||
static constexpr string_view_t blink = "\033[5m";
|
||||
static constexpr string_view_t reverse = "\033[7m";
|
||||
static constexpr string_view_t concealed = "\033[8m";
|
||||
static constexpr string_view_t clear_line = "\033[K";
|
||||
|
||||
// Foreground colors
|
||||
const string_view_t black = "\033[30m";
|
||||
const string_view_t red = "\033[31m";
|
||||
const string_view_t green = "\033[32m";
|
||||
const string_view_t yellow = "\033[33m";
|
||||
const string_view_t blue = "\033[34m";
|
||||
const string_view_t magenta = "\033[35m";
|
||||
const string_view_t cyan = "\033[36m";
|
||||
const string_view_t white = "\033[37m";
|
||||
static constexpr string_view_t black = "\033[30m";
|
||||
static constexpr string_view_t red = "\033[31m";
|
||||
static constexpr string_view_t green = "\033[32m";
|
||||
static constexpr string_view_t yellow = "\033[33m";
|
||||
static constexpr string_view_t blue = "\033[34m";
|
||||
static constexpr string_view_t magenta = "\033[35m";
|
||||
static constexpr string_view_t cyan = "\033[36m";
|
||||
static constexpr string_view_t white = "\033[37m";
|
||||
|
||||
/// Background colors
|
||||
const string_view_t on_black = "\033[40m";
|
||||
const string_view_t on_red = "\033[41m";
|
||||
const string_view_t on_green = "\033[42m";
|
||||
const string_view_t on_yellow = "\033[43m";
|
||||
const string_view_t on_blue = "\033[44m";
|
||||
const string_view_t on_magenta = "\033[45m";
|
||||
const string_view_t on_cyan = "\033[46m";
|
||||
const string_view_t on_white = "\033[47m";
|
||||
static constexpr string_view_t on_black = "\033[40m";
|
||||
static constexpr string_view_t on_red = "\033[41m";
|
||||
static constexpr string_view_t on_green = "\033[42m";
|
||||
static constexpr string_view_t on_yellow = "\033[43m";
|
||||
static constexpr string_view_t on_blue = "\033[44m";
|
||||
static constexpr string_view_t on_magenta = "\033[45m";
|
||||
static constexpr string_view_t on_cyan = "\033[46m";
|
||||
static constexpr string_view_t on_white = "\033[47m";
|
||||
|
||||
/// Bold colors
|
||||
const string_view_t yellow_bold = "\033[33m\033[1m";
|
||||
const string_view_t red_bold = "\033[31m\033[1m";
|
||||
const string_view_t bold_on_red = "\033[1m\033[41m";
|
||||
static constexpr string_view_t yellow_bold = "\033[33m\033[1m";
|
||||
static constexpr string_view_t red_bold = "\033[31m\033[1m";
|
||||
static constexpr string_view_t bold_on_red = "\033[1m\033[41m";
|
||||
|
||||
private:
|
||||
FILE *target_file_;
|
||||
|
Loading…
Reference in New Issue
Block a user