|
spdlog
|
This sink prefixes the output with an ANSI escape sequence color code depending on the severity of the message. If no color terminal detected, omit the escape codes.
Definition at line 25 of file ansicolor_sink.h.
#include <ansicolor_sink.h>
Public Types | |
| using | mutex_t = typename ConsoleMutex::mutex_t |
Public Member Functions | |
| ansicolor_sink (FILE *target_file, color_mode mode) | |
| ~ansicolor_sink () override=default | |
| ansicolor_sink (const ansicolor_sink &other)=delete | |
| ansicolor_sink (ansicolor_sink &&other)=delete | |
| ansicolor_sink & | operator= (const ansicolor_sink &other)=delete |
| ansicolor_sink & | operator= (ansicolor_sink &&other)=delete |
| void | set_color (level::level_enum color_level, string_view_t color) |
| void | set_color_mode (color_mode mode) |
| bool | should_color () |
| void | log (const details::log_msg &msg) override |
| void | flush () override |
| void | set_pattern (const std::string &pattern) final |
| void | set_formatter (std::unique_ptr< spdlog::formatter > sink_formatter) override |
| void | set_level (level::level_enum log_level) |
| level::level_enum | level () const |
| bool | should_log (level::level_enum msg_level) const |
Public Attributes | |
| 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" |
| 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" |
| const string_view_t | on_black = "\033[40m" |
| Background colors. | |
| 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" |
| const string_view_t | yellow_bold = "\033[33m\033[1m" |
| Bold colors. | |
| const string_view_t | red_bold = "\033[31m\033[1m" |
| const string_view_t | bold_on_red = "\033[1m\033[41m" |
Protected Attributes | |
| level_t | level_ {level::trace} |
Private Member Functions | |
| void | print_ccode_ (const string_view_t &color_code) |
| void | print_range_ (const memory_buf_t &formatted, size_t start, size_t end) |
Static Private Member Functions | |
| static std::string | to_string_ (const string_view_t &sv) |
Private Attributes | |
| FILE * | target_file_ |
| mutex_t & | mutex_ |
| bool | should_do_colors_ |
| std::unique_ptr< spdlog::formatter > | formatter_ |
| std::array< std::string, level::n_levels > | colors_ |
| using spdlog::sinks::ansicolor_sink< ConsoleMutex >::mutex_t = typename ConsoleMutex::mutex_t |
Definition at line 28 of file ansicolor_sink.h.
| SPDLOG_INLINE spdlog::sinks::ansicolor_sink< ConsoleMutex >::ansicolor_sink | ( | FILE * | target_file, |
| color_mode | mode | ||
| ) |
Definition at line 17 of file ansicolor_sink-inl.h.
|
overridedefault |
|
delete |
|
delete |
|
overridevirtual |
Implements spdlog::sinks::sink.
Definition at line 69 of file ansicolor_sink-inl.h.
|
inherited |
Definition at line 22 of file sink-inl.h.
|
overridevirtual |
Implements spdlog::sinks::sink.
Definition at line 41 of file ansicolor_sink-inl.h.
|
delete |
|
delete |
|
private |
Definition at line 115 of file ansicolor_sink-inl.h.
|
private |
Definition at line 121 of file ansicolor_sink-inl.h.
| SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::set_color | ( | level::level_enum | color_level, |
| string_view_t | color | ||
| ) |
Definition at line 34 of file ansicolor_sink-inl.h.
| SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::set_color_mode | ( | color_mode | mode | ) |
Definition at line 96 of file ansicolor_sink-inl.h.
|
overridevirtual |
Implements spdlog::sinks::sink.
Definition at line 83 of file ansicolor_sink-inl.h.
|
inherited |
Definition at line 17 of file sink-inl.h.
|
finalvirtual |
Implements spdlog::sinks::sink.
Definition at line 76 of file ansicolor_sink-inl.h.
| SPDLOG_INLINE bool spdlog::sinks::ansicolor_sink< ConsoleMutex >::should_color | ( | ) |
Definition at line 90 of file ansicolor_sink-inl.h.
|
inherited |
Definition at line 12 of file sink-inl.h.
|
staticprivate |
Definition at line 127 of file ansicolor_sink-inl.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::black = "\033[30m" |
Definition at line 58 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::blink = "\033[5m" |
Definition at line 52 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::blue = "\033[34m" |
Definition at line 62 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::bold = "\033[1m" |
Definition at line 49 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::bold_on_red = "\033[1m\033[41m" |
Definition at line 80 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::clear_line = "\033[K" |
Definition at line 55 of file ansicolor_sink.h.
|
private |
Definition at line 87 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::concealed = "\033[8m" |
Definition at line 54 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::cyan = "\033[36m" |
Definition at line 64 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::dark = "\033[2m" |
Definition at line 50 of file ansicolor_sink.h.
|
private |
Definition at line 86 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::green = "\033[32m" |
Definition at line 60 of file ansicolor_sink.h.
|
protectedinherited |
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::magenta = "\033[35m" |
Definition at line 63 of file ansicolor_sink.h.
|
private |
Definition at line 84 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_black = "\033[40m" |
Background colors.
Definition at line 68 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_blue = "\033[44m" |
Definition at line 72 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_cyan = "\033[46m" |
Definition at line 74 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_green = "\033[42m" |
Definition at line 70 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_magenta = "\033[45m" |
Definition at line 73 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_red = "\033[41m" |
Definition at line 69 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_white = "\033[47m" |
Definition at line 75 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_yellow = "\033[43m" |
Definition at line 71 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::red = "\033[31m" |
Definition at line 59 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::red_bold = "\033[31m\033[1m" |
Definition at line 79 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::reset = "\033[m" |
Definition at line 48 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::reverse = "\033[7m" |
Definition at line 53 of file ansicolor_sink.h.
|
private |
Definition at line 85 of file ansicolor_sink.h.
|
private |
Definition at line 83 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::underline = "\033[4m" |
Definition at line 51 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::white = "\033[37m" |
Definition at line 65 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::yellow = "\033[33m" |
Definition at line 61 of file ansicolor_sink.h.
| const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::yellow_bold = "\033[33m\033[1m" |
Bold colors.
Definition at line 78 of file ansicolor_sink.h.