nestlog: minor scope fixes

This commit is contained in:
Roland Conybeare 2023-09-12 16:42:10 -04:00
commit f7c19c338f

View file

@ -15,19 +15,19 @@ namespace xo {
template <typename ChartT, typename Traits>
class state_impl;
# define XO_ENTER0() xo::scope_setup(log_config::style, __PRETTY_FUNCTION__)
# define XO_ENTER1(debug_flag) xo::scope_setup(log_config::style, __PRETTY_FUNCTION__, debug_flag)
# define XO_ENTER0() xo::scope_setup(xo::log_config::style, __PRETTY_FUNCTION__)
# define XO_ENTER1(debug_flag) xo::scope_setup(xo::log_config::style, __PRETTY_FUNCTION__, debug_flag)
//# define XO_SSETUP0() xo::scope_setup(__FUNCTION__)
# define XO_SSETUP0() xo::scope_setup(log_config::style, __PRETTY_FUNCTION__)
# define XO_SSETUP0() xo::scope_setup(xo::log_config::style, __PRETTY_FUNCTION__)
/* throw exception if condition not met*/
# define XO_EXPECT(f,msg) if(!(f)) { throw std::runtime_error(msg); }
/* establish scope using current function name */
# define XO_SCOPE(name) xo::scope name(xo::scope_setup(log_config::style, __PRETTY_FUNCTION__))
# define XO_SCOPE(name) xo::scope name(xo::scope_setup(xo::log_config::style, __PRETTY_FUNCTION__))
/* like XO_SCOPE(name), but also set enabled flag */
# define XO_SCOPE2(name, debug_flag) xo::scope name(xo::scope_setup(log_config::style, __PRETTY_FUNCTION__, debug_flag))
# define XO_SCOPE_DISABLED(name) xo::scope name(xo::scope_setup(log_config::style, __PRETTY_FUNCTION__, false))
# define XO_SCOPE2(name, debug_flag) xo::scope name(xo::scope_setup(xo::log_config::style, __PRETTY_FUNCTION__, debug_flag))
# define XO_SCOPE_DISABLED(name) xo::scope name(xo::scope_setup(xo::log_config::style, __PRETTY_FUNCTION__, false))
# define XO_STUB() { XO_SCOPE(logr); logr.log("STUB"); }
/* convenience class for basic_scope<..> construction (see below).
@ -42,6 +42,7 @@ namespace xo {
: scope_setup(style, name1, true /*enabled_flag*/) {}
static scope_setup literal(std::string_view name1, bool enabled_flag = true) { return scope_setup(FS_Literal, name1, enabled_flag); }
static scope_setup literal(std::string_view name1, std::string_view name2, bool enabled_flag = true) { return scope_setup(FS_Literal, name1, name2, enabled_flag); }
function_style style_ = FS_Pretty;
std::string_view name1_ = "<.name1>";