add styling trackers

pull/2814/head
drakbar 2 years ago
parent d1e8669d8a
commit af7584d818

@ -6,8 +6,49 @@
#include <spdlog/common.h>
#include <string>
namespace spdlog {
namespace details {
#if !defined(_WIN32) && defined(SPDLOG_EXTENDED_STLYING)
#include <vector>
#include <array>
enum class style_type
{
// reservation for data structures
null_style,
// font style
reset, bold, dark, underline, blink, reverse,
// font foreground colors
fg_black, fg_red, fg_green, fg_yellow, fg_blue, fg_magenta, fg_cyan, fg_white, fg_default,
// font background colors
bg_black, bg_red, bg_green, bg_yellow, bg_blue, bg_magenta, bg_cyan, bg_white, bg_default,
};
#if !defined(SPDLOG_ANSI_STLYE_COUNT)
# define SPDLOG_ANSI_STLYE_COUNT 25
using styles_array = std::array<details::style_type, SPDLOG_ANSI_STLYE_COUNT>;
using style_strings = std::array<std::string, SPDLOG_ANSI_STLYE_COUNT>;
using style_codes = std::array<string_view_t, SPDLOG_ANSI_STLYE_COUNT>;
#endif
// styling info.
struct styling_info
{
styling_info() = default;
styling_info(details::styles_array styles)
: styles(styles)
, is_start(true)
{}
bool is_start = false;
size_t position = 0;
details::styles_array styles{};
};
#endif
struct SPDLOG_API log_msg
{
log_msg() = default;
@ -26,6 +67,11 @@ struct SPDLOG_API log_msg
mutable size_t color_range_start{0};
mutable size_t color_range_end{0};
#if !defined(_WIN32) && defined(SPDLOG_EXTENDED_STLYING)
// for ansi console styling
mutable std::vector<styling_info> styling_ranges;
#endif
source_loc source;
string_view_t payload;
};

Loading…
Cancel
Save