mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-27 07:59:03 +08:00
Added const qualifiers to some ansicolor_sink functions
This commit is contained in:
parent
aa97311b99
commit
58ce6f4dd9
@ -82,7 +82,7 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::set_formatter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename ConsoleMutex>
|
template <typename ConsoleMutex>
|
||||||
SPDLOG_INLINE bool ansicolor_sink<ConsoleMutex>::should_color() {
|
SPDLOG_INLINE bool ansicolor_sink<ConsoleMutex>::should_color() const {
|
||||||
return should_do_colors_;
|
return should_do_colors_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,14 +111,14 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::set_color_mode_(color_mode mode
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename ConsoleMutex>
|
template <typename ConsoleMutex>
|
||||||
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::print_ccode_(const string_view_t &color_code) {
|
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::print_ccode_(const string_view_t &color_code) const {
|
||||||
details::os::fwrite_bytes(color_code.data(), color_code.size(), target_file_);
|
details::os::fwrite_bytes(color_code.data(), color_code.size(), target_file_);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ConsoleMutex>
|
template <typename ConsoleMutex>
|
||||||
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::print_range_(const memory_buf_t &formatted,
|
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::print_range_(const memory_buf_t &formatted,
|
||||||
size_t start,
|
size_t start,
|
||||||
size_t end) {
|
size_t end) const {
|
||||||
details::os::fwrite_bytes(formatted.data() + start, end - start, target_file_);
|
details::os::fwrite_bytes(formatted.data() + start, end - start, target_file_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
|
|
||||||
void set_color(level::level_enum color_level, string_view_t color);
|
void set_color(level::level_enum color_level, string_view_t color);
|
||||||
void set_color_mode(color_mode mode);
|
void set_color_mode(color_mode mode);
|
||||||
bool should_color();
|
bool should_color() const;
|
||||||
|
|
||||||
void log(const details::log_msg &msg) override;
|
void log(const details::log_msg &msg) override;
|
||||||
void flush() override;
|
void flush() override;
|
||||||
@ -85,8 +85,8 @@ private:
|
|||||||
std::unique_ptr<spdlog::formatter> formatter_;
|
std::unique_ptr<spdlog::formatter> formatter_;
|
||||||
std::array<std::string, level::n_levels> colors_;
|
std::array<std::string, level::n_levels> colors_;
|
||||||
void set_color_mode_(color_mode mode);
|
void set_color_mode_(color_mode mode);
|
||||||
void print_ccode_(const string_view_t &color_code);
|
void print_ccode_(const string_view_t &color_code) const;
|
||||||
void print_range_(const memory_buf_t &formatted, size_t start, size_t end);
|
void print_range_(const memory_buf_t &formatted, size_t start, size_t end) const;
|
||||||
static std::string to_string_(const string_view_t &sv);
|
static std::string to_string_(const string_view_t &sv);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user