#include <ansicolor_sink.h>
Public Types | |
using | mutex_t = typename ConsoleMutex::mutex_t |
Public Member Functions | |
ansicolor_sink () | |
~ansicolor_sink () override=default | |
ansicolor_sink (const ansicolor_sink &other)=delete | |
ansicolor_sink & | operator= (const ansicolor_sink &other)=delete |
void | set_color (level::level_enum color_level, const std::string &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 |
Public Member Functions inherited from spdlog::sinks::sink | |
sink () | |
sink (std::unique_ptr< spdlog::pattern_formatter > formatter) | |
virtual | ~sink ()=default |
bool | should_log (level::level_enum msg_level) const |
void | set_level (level::level_enum log_level) |
level::level_enum | level () const |
Public Attributes | |
const std::string | reset = "\033[m" |
Formatting codes. More... | |
const std::string | bold = "\033[1m" |
const std::string | dark = "\033[2m" |
const std::string | underline = "\033[4m" |
const std::string | blink = "\033[5m" |
const std::string | reverse = "\033[7m" |
const std::string | concealed = "\033[8m" |
const std::string | clear_line = "\033[K" |
const std::string | black = "\033[30m" |
const std::string | red = "\033[31m" |
const std::string | green = "\033[32m" |
const std::string | yellow = "\033[33m" |
const std::string | blue = "\033[34m" |
const std::string | magenta = "\033[35m" |
const std::string | cyan = "\033[36m" |
const std::string | white = "\033[37m" |
const std::string | on_black = "\033[40m" |
Background colors. More... | |
const std::string | on_red = "\033[41m" |
const std::string | on_green = "\033[42m" |
const std::string | on_yellow = "\033[43m" |
const std::string | on_blue = "\033[44m" |
const std::string | on_magenta = "\033[45m" |
const std::string | on_cyan = "\033[46m" |
const std::string | on_white = "\033[47m" |
Private Member Functions | |
void | print_ccode_ (const std::string &color_code) |
void | print_range_ (const fmt::memory_buffer &formatted, size_t start, size_t end) |
Private Attributes | |
FILE * | target_file_ |
mutex_t & | mutex_ |
bool | should_do_colors_ |
std::unordered_map< level::level_enum, std::string, level::level_hasher > | colors_ |
Additional Inherited Members | |
Protected Attributes inherited from spdlog::sinks::sink | |
level_t | level_ |
std::unique_ptr< spdlog::formatter > | formatter_ |
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 32 of file ansicolor_sink.h.
using spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::mutex_t = typename ConsoleMutex::mutex_t |
Definition at line 35 of file ansicolor_sink.h.
|
inline |
Definition at line 36 of file ansicolor_sink.h.
|
overridedefault |
|
delete |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements spdlog::sinks::sink.
Definition at line 92 of file ansicolor_sink.h.
|
delete |
|
inlineprivate |
Definition at line 137 of file ansicolor_sink.h.
|
inlineprivate |
Definition at line 141 of file ansicolor_sink.h.
|
inline |
Definition at line 56 of file ansicolor_sink.h.
|
inlineoverridevirtual |
|
inlinefinalvirtual |
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::black = "\033[30m" |
Definition at line 73 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::blink = "\033[5m" |
Definition at line 67 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::blue = "\033[34m" |
Definition at line 77 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::bold = "\033[1m" |
Definition at line 64 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::clear_line = "\033[K" |
Definition at line 70 of file ansicolor_sink.h.
|
private |
Definition at line 150 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::concealed = "\033[8m" |
Definition at line 69 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::cyan = "\033[36m" |
Definition at line 79 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::dark = "\033[2m" |
Definition at line 65 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::green = "\033[32m" |
Definition at line 75 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::magenta = "\033[35m" |
Definition at line 78 of file ansicolor_sink.h.
|
private |
Definition at line 147 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_black = "\033[40m" |
Background colors.
Definition at line 83 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_blue = "\033[44m" |
Definition at line 87 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_cyan = "\033[46m" |
Definition at line 89 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_green = "\033[42m" |
Definition at line 85 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_magenta = "\033[45m" |
Definition at line 88 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_red = "\033[41m" |
Definition at line 84 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_white = "\033[47m" |
Definition at line 90 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::on_yellow = "\033[43m" |
Definition at line 86 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::red = "\033[31m" |
Definition at line 74 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::reset = "\033[m" |
Formatting codes.
Definition at line 63 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::reverse = "\033[7m" |
Definition at line 68 of file ansicolor_sink.h.
|
private |
Definition at line 149 of file ansicolor_sink.h.
|
private |
Definition at line 146 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::underline = "\033[4m" |
Definition at line 66 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::white = "\033[37m" |
Definition at line 80 of file ansicolor_sink.h.
const std::string spdlog::sinks::ansicolor_sink< TargetStream, ConsoleMutex >::yellow = "\033[33m" |
Definition at line 76 of file ansicolor_sink.h.