20 #include <unordered_map> 31 template<
typename TargetStream,
class ConsoleMutex>
35 using mutex_t =
typename ConsoleMutex::mutex_t;
58 std::lock_guard<mutex_t> lock(
mutex_);
96 std::lock_guard<mutex_t> lock(
mutex_);
120 std::lock_guard<mutex_t> lock(
mutex_);
126 std::lock_guard<mutex_t> lock(
mutex_);
130 void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter)
override 132 std::lock_guard<mutex_t> lock(
mutex_);
139 fwrite(color_code.data(),
sizeof(char), color_code.size(),
target_file_);
143 fwrite(formatted.data() + start,
sizeof(char), end - start,
target_file_);
150 std::unordered_map<level::level_enum, std::string, level::level_hasher>
colors_;
const std::string on_yellow
const std::string reverse
const std::string on_black
Background colors.
~ansicolor_sink() override=default
void msg(const char *fmt,...)
const std::string reset
Formatting codes.
const std::string underline
std::unique_ptr< spdlog::formatter > formatter_
const std::string magenta
const std::string on_white
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
const std::string on_blue
const std::string concealed
const std::string on_cyan
void set_pattern(const std::string &pattern) final
bool in_terminal(FILE *file) SPDLOG_NOEXCEPT
typename ConsoleMutex::mutex_t mutex_t
const std::string clear_line
bool is_color_terminal() SPDLOG_NOEXCEPT
void print_ccode_(const std::string &color_code)
void log(const details::log_msg &msg) override
void set_color(level::level_enum color_level, const std::string &color)
std::unordered_map< level::level_enum, std::string, level::level_hasher > colors_
void set_formatter(std::unique_ptr< spdlog::formatter > sink_formatter) override
void print_range_(const fmt::memory_buffer &formatted, size_t start, size_t end)
const std::string on_magenta
const std::string on_green
ansicolor_sink & operator=(const ansicolor_sink &other)=delete