diff --git a/include/spdlog/details/log_msg.h b/include/spdlog/details/log_msg.h index fed51abd..ec3976c3 100644 --- a/include/spdlog/details/log_msg.h +++ b/include/spdlog/details/log_msg.h @@ -6,8 +6,49 @@ #include #include + namespace spdlog { namespace details { + +#if !defined(_WIN32) && defined(SPDLOG_EXTENDED_STLYING) + +#include +#include + +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; + using style_strings = std::array; + using style_codes = std::array; +#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_ranges; +#endif + source_loc source; string_view_t payload; };