Agora  1.2.0
Agora project
spdlog::sinks::ansicolor_sink< ConsoleMutex > Class Template Reference

#include <ansicolor_sink.h>

Inheritance diagram for spdlog::sinks::ansicolor_sink< ConsoleMutex >:
Collaboration diagram for spdlog::sinks::ansicolor_sink< ConsoleMutex >:

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_sinkoperator= (const ansicolor_sink &other)=delete
 
ansicolor_sinkoperator= (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
 
- Public Member Functions inherited from spdlog::sinks::sink
virtual ~sink ()=default
 
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. More...
 
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. More...
 
const string_view_t red_bold = "\033[31m\033[1m"
 
const string_view_t bold_on_red = "\033[1m\033[41m"
 

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_tmutex_
 
bool should_do_colors_
 
std::unique_ptr< spdlog::formatterformatter_
 
std::array< std::string, level::n_levelscolors_
 

Additional Inherited Members

- Protected Attributes inherited from spdlog::sinks::sink
level_t level_ {level::trace}
 

Detailed Description

template<typename ConsoleMutex>
class spdlog::sinks::ansicolor_sink< ConsoleMutex >

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.

Member Typedef Documentation

◆ mutex_t

template<typename ConsoleMutex >
using spdlog::sinks::ansicolor_sink< ConsoleMutex >::mutex_t = typename ConsoleMutex::mutex_t

Constructor & Destructor Documentation

◆ ansicolor_sink() [1/3]

template<typename ConsoleMutex >
SPDLOG_INLINE spdlog::sinks::ansicolor_sink< ConsoleMutex >::ansicolor_sink ( FILE *  target_file,
color_mode  mode 
)
Here is the call graph for this function:

◆ ~ansicolor_sink()

template<typename ConsoleMutex >
spdlog::sinks::ansicolor_sink< ConsoleMutex >::~ansicolor_sink ( )
overridedefault

◆ ansicolor_sink() [2/3]

template<typename ConsoleMutex >
spdlog::sinks::ansicolor_sink< ConsoleMutex >::ansicolor_sink ( const ansicolor_sink< ConsoleMutex > &  other)
delete

◆ ansicolor_sink() [3/3]

template<typename ConsoleMutex >
spdlog::sinks::ansicolor_sink< ConsoleMutex >::ansicolor_sink ( ansicolor_sink< ConsoleMutex > &&  other)
delete

Member Function Documentation

◆ flush()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::flush
overridevirtual

Implements spdlog::sinks::sink.

◆ log()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::log ( const details::log_msg msg)
overridevirtual

Implements spdlog::sinks::sink.

Here is the call graph for this function:

◆ operator=() [1/2]

template<typename ConsoleMutex >
ansicolor_sink& spdlog::sinks::ansicolor_sink< ConsoleMutex >::operator= ( ansicolor_sink< ConsoleMutex > &&  other)
delete

◆ operator=() [2/2]

template<typename ConsoleMutex >
ansicolor_sink& spdlog::sinks::ansicolor_sink< ConsoleMutex >::operator= ( const ansicolor_sink< ConsoleMutex > &  other)
delete

◆ print_ccode_()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::print_ccode_ ( const string_view_t color_code)
private
Here is the call graph for this function:

◆ print_range_()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::print_range_ ( const memory_buf_t formatted,
size_t  start,
size_t  end 
)
private
Here is the call graph for this function:

◆ set_color()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::set_color ( level::level_enum  color_level,
string_view_t  color 
)

◆ set_color_mode()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::set_color_mode ( color_mode  mode)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_formatter()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::set_formatter ( std::unique_ptr< spdlog::formatter sink_formatter)
overridevirtual

Implements spdlog::sinks::sink.

◆ set_pattern()

template<typename ConsoleMutex >
SPDLOG_INLINE void spdlog::sinks::ansicolor_sink< ConsoleMutex >::set_pattern ( const std::string &  pattern)
finalvirtual

Implements spdlog::sinks::sink.

◆ should_color()

template<typename ConsoleMutex >
SPDLOG_INLINE bool spdlog::sinks::ansicolor_sink< ConsoleMutex >::should_color

◆ to_string_()

template<typename ConsoleMutex >
SPDLOG_INLINE std::string spdlog::sinks::ansicolor_sink< ConsoleMutex >::to_string_ ( const string_view_t sv)
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ black

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::black = "\033[30m"

◆ blink

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::blink = "\033[5m"

◆ blue

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::blue = "\033[34m"

◆ bold

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::bold = "\033[1m"

◆ bold_on_red

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::bold_on_red = "\033[1m\033[41m"

◆ clear_line

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::clear_line = "\033[K"

◆ colors_

template<typename ConsoleMutex >
std::array<std::string, level::n_levels> spdlog::sinks::ansicolor_sink< ConsoleMutex >::colors_
private

◆ concealed

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::concealed = "\033[8m"

◆ cyan

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::cyan = "\033[36m"

◆ dark

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::dark = "\033[2m"

◆ formatter_

template<typename ConsoleMutex >
std::unique_ptr<spdlog::formatter> spdlog::sinks::ansicolor_sink< ConsoleMutex >::formatter_
private

◆ green

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::green = "\033[32m"

◆ magenta

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::magenta = "\033[35m"

◆ mutex_

template<typename ConsoleMutex >
mutex_t& spdlog::sinks::ansicolor_sink< ConsoleMutex >::mutex_
private

◆ on_black

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_black = "\033[40m"

Background colors.

◆ on_blue

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_blue = "\033[44m"

◆ on_cyan

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_cyan = "\033[46m"

◆ on_green

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_green = "\033[42m"

◆ on_magenta

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_magenta = "\033[45m"

◆ on_red

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_red = "\033[41m"

◆ on_white

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_white = "\033[47m"

◆ on_yellow

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::on_yellow = "\033[43m"

◆ red

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::red = "\033[31m"

◆ red_bold

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::red_bold = "\033[31m\033[1m"

◆ reset

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::reset = "\033[m"

◆ reverse

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::reverse = "\033[7m"

◆ should_do_colors_

template<typename ConsoleMutex >
bool spdlog::sinks::ansicolor_sink< ConsoleMutex >::should_do_colors_
private

◆ target_file_

template<typename ConsoleMutex >
FILE* spdlog::sinks::ansicolor_sink< ConsoleMutex >::target_file_
private

◆ underline

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::underline = "\033[4m"

◆ white

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::white = "\033[37m"

◆ yellow

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::yellow = "\033[33m"

◆ yellow_bold

template<typename ConsoleMutex >
const string_view_t spdlog::sinks::ansicolor_sink< ConsoleMutex >::yellow_bold = "\033[33m\033[1m"

Bold colors.


The documentation for this class was generated from the following files: