Agora
1.2.0
Agora project
|
Go to the documentation of this file.
6 #ifndef SPDLOG_HEADER_ONLY
16 template<
typename ConsoleMutex>
18 : target_file_(target_file)
19 , mutex_(ConsoleMutex::mutex())
33 template<
typename ConsoleMutex>
36 std::lock_guard<mutex_t> lock(mutex_);
37 colors_[
static_cast<size_t>(color_level)] = to_string_(
color);
40 template<
typename ConsoleMutex>
45 std::lock_guard<mutex_t> lock(mutex_);
49 formatter_->format(msg, formatted);
55 print_ccode_(colors_[
static_cast<size_t>(msg.
level)]);
63 print_range_(formatted, 0, formatted.
size());
68 template<
typename ConsoleMutex>
71 std::lock_guard<mutex_t> lock(mutex_);
75 template<
typename ConsoleMutex>
78 std::lock_guard<mutex_t> lock(mutex_);
82 template<
typename ConsoleMutex>
85 std::lock_guard<mutex_t> lock(mutex_);
86 formatter_ = std::move(sink_formatter);
89 template<
typename ConsoleMutex>
92 return should_do_colors_;
95 template<
typename ConsoleMutex>
101 should_do_colors_ =
true;
107 should_do_colors_ =
false;
110 should_do_colors_ =
false;
114 template<
typename ConsoleMutex>
117 fwrite(color_code.
data(),
sizeof(
char), color_code.
size(), target_file_);
120 template<
typename ConsoleMutex>
126 template<
typename ConsoleMutex>
129 return std::string(sv.
data(), sv.
size());
133 template<
typename ConsoleMutex>
139 template<
typename ConsoleMutex>
color
Definition: color.h:23
SPDLOG_INLINE bool in_terminal(FILE *file) SPDLOG_NOEXCEPT
Definition: os-inl.h:447
const string_view_t white
Definition: ansicolor_sink.h:65
std::array< std::string, level::n_levels > colors_
Definition: ansicolor_sink.h:87
const string_view_t cyan
Definition: ansicolor_sink.h:64
@ trace
Definition: common.h:213
void set_formatter(std::unique_ptr< spdlog::formatter > sink_formatter) override
Definition: ansicolor_sink-inl.h:83
@ off
Definition: common.h:219
@ warn
Definition: common.h:216
string mode
Definition: mm_gui.py:105
constexpr auto size() const -> size_t
Definition: core.h:820
void flush() override
Definition: ansicolor_sink-inl.h:69
constexpr auto size() const -> size_t
Definition: core.h:495
@ info
Definition: common.h:215
level_enum
Definition: common.h:211
static std::string to_string_(const string_view_t &sv)
Definition: ansicolor_sink-inl.h:127
size_t color_range_end
Definition: log_msg.h:27
@ debug
Definition: common.h:214
bool should_color()
Definition: ansicolor_sink-inl.h:90
@ err
Definition: common.h:217
SPDLOG_INLINE bool is_color_terminal() SPDLOG_NOEXCEPT
Definition: os-inl.h:416
void set_pattern(const std::string &pattern) final
Definition: ansicolor_sink-inl.h:76
void print_range_(const memory_buf_t &formatted, size_t start, size_t end)
Definition: ansicolor_sink-inl.h:121
const string_view_t bold_on_red
Definition: ansicolor_sink.h:80
const string_view_t yellow_bold
Bold colors.
Definition: ansicolor_sink.h:78
#define SPDLOG_INLINE
Definition: common.h:42
void print_ccode_(const string_view_t &color_code)
Definition: ansicolor_sink-inl.h:115
end start
Definition: inspect_agora_results.m:95
std::unique_ptr< T > make_unique(Args &&... args)
Definition: common.h:334
level::level_enum level
Definition: log_msg.h:21
const string_view_t reset
Definition: ansicolor_sink.h:48
ansicolor_stderr_sink(color_mode mode=color_mode::automatic)
Definition: ansicolor_sink-inl.h:140
auto data() -> T *
Definition: core.h:826
constexpr auto data() const -> const Char *
Definition: core.h:492
const string_view_t red_bold
Definition: ansicolor_sink.h:79
void set_color_mode(color_mode mode)
Definition: ansicolor_sink-inl.h:96
void set_color(level::level_enum color_level, string_view_t color)
Definition: ansicolor_sink-inl.h:34
fwrite(fileID, pilot_f, 'float')
ansicolor_sink(FILE *target_file, color_mode mode)
Definition: ansicolor_sink-inl.h:17
Definition: ansicolor_sink.h:25
size_t color_range_start
Definition: log_msg.h:26
const string_view_t green
Definition: ansicolor_sink.h:60
void log(const details::log_msg &msg) override
Definition: ansicolor_sink-inl.h:41
@ critical
Definition: common.h:218
color_mode
Definition: common.h:256
ansicolor_stdout_sink(color_mode mode=color_mode::automatic)
Definition: ansicolor_sink-inl.h:134