indentlog: refactor: log_config function_name uses color_spec
This commit is contained in:
parent
9a12eba62f
commit
0c9eb6e2da
4 changed files with 10 additions and 32 deletions
|
|
@ -32,8 +32,8 @@ main(int argc, char ** argv) {
|
|||
log_config::max_indent_width = 30;
|
||||
log_config::location_tab = 80;
|
||||
log_config::encoding = CE_Xterm;
|
||||
log_config::function_entry_color = 69;
|
||||
log_config::function_exit_color = 70;
|
||||
log_config::function_entry_color = color_spec::xterm(69);
|
||||
log_config::function_exit_color = color_spec::xterm(70);
|
||||
log_config::code_location_color = color_spec::xterm(166);
|
||||
|
||||
int n = 3;
|
||||
|
|
|
|||
|
|
@ -143,31 +143,11 @@ namespace xo {
|
|||
Contents contents_;
|
||||
}; /*color_impl*/
|
||||
|
||||
template <typename Contents>
|
||||
color_impl<Contents> with_ansi_color(std::uint32_t color, Contents && contents) {
|
||||
return color_impl<Contents>(CF_All, color_spec::ansi(color), std::forward(contents));
|
||||
} /*with_ansi_color*/
|
||||
|
||||
template <typename Contents>
|
||||
color_impl<Contents> with_xterm_color(std::uint32_t color, Contents && contents) {
|
||||
return color_impl<Contents>(CF_All, color_spec::xterm(color), std::forward(contents));
|
||||
} /*with_ansi_color*/
|
||||
|
||||
template <typename Contents>
|
||||
color_impl<Contents> with_color(color_spec spec, Contents && contents) {
|
||||
return color_impl<Contents>(CF_All, spec, std::forward<Contents>(contents));
|
||||
} /*with_color*/
|
||||
|
||||
inline color_impl<int>
|
||||
color_on_ansi(std::uint32_t color) {
|
||||
return color_impl<int>(CF_ColorOn, color_spec::ansi(color), 0);
|
||||
} /*color_on_ansi*/
|
||||
|
||||
inline color_impl<int>
|
||||
color_on_xterm(std::uint32_t color) {
|
||||
return color_impl<int>(CF_ColorOn, color_spec::xterm(color), 0);
|
||||
} /*color_on_xterm*/
|
||||
|
||||
inline color_impl<int>
|
||||
color_on(color_spec spec) {
|
||||
return color_impl<int>(CF_ColorOn, spec, 0);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ namespace xo {
|
|||
/* color to use for function name, on entry/exit (xo::scope creation/destruction)
|
||||
* (ansi color codes, see Select Graphics Rendition subset)
|
||||
*/
|
||||
static std::uint32_t function_entry_color;
|
||||
static std::uint32_t function_exit_color;
|
||||
static color_spec function_entry_color;
|
||||
static color_spec function_exit_color;
|
||||
/* if true, append [file:line] to output */
|
||||
static bool location_enabled;
|
||||
/* when .location_enabled, write [file:line] starting this many chars from left margin */
|
||||
|
|
@ -85,12 +85,12 @@ namespace xo {
|
|||
log_config_impl<Tag>::encoding = CE_Ansi;
|
||||
|
||||
template <typename Tag>
|
||||
std::uint32_t
|
||||
log_config_impl<Tag>::function_entry_color = 34;
|
||||
color_spec
|
||||
log_config_impl<Tag>::function_entry_color = color_spec::ansi(34);
|
||||
|
||||
template <typename Tag>
|
||||
std::uint32_t
|
||||
log_config_impl<Tag>::function_exit_color = 32;
|
||||
color_spec
|
||||
log_config_impl<Tag>::function_exit_color = color_spec::ansi(32);
|
||||
|
||||
template <typename Tag>
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -194,9 +194,7 @@ namespace xo {
|
|||
this->indent(' ');
|
||||
|
||||
char ee_label = '\0';
|
||||
std::uint32_t fn_color = 0;
|
||||
|
||||
color_encoding encoding = log_config::encoding;
|
||||
color_spec fn_color;
|
||||
|
||||
/* mnemonic for scope entry/exit */
|
||||
switch(entryexit) {
|
||||
|
|
@ -232,7 +230,7 @@ namespace xo {
|
|||
this->ss_ << ' ';
|
||||
|
||||
/* scope name - note no trailing newline; expect .preamble()/.postamble() caller to supply */
|
||||
this->ss_ << function_name(style, color_spec(encoding, fn_color), name1) << name2;
|
||||
this->ss_ << function_name(style, fn_color, name1) << name2;
|
||||
} /*entryexit_aux*/
|
||||
|
||||
template <typename CharT, typename Traits>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue