MCPcopy Create free account
hub / github.com/ashaduri/gsmartcontrol / main_impl

Function main_impl

src/libdebug/examples/example_libdebug.cpp:69–139  ·  view source on GitHub ↗

A separate function is needed to avoid clang-tidy complaining about capturing __function__ from lambda.

Source from the content-addressed store, hash-verified

67
68/// A separate function is needed to avoid clang-tidy complaining about capturing __function__ from lambda.
69int main_impl()
70{
71 debug_register_domain("dom");
72
73 debug_set_enabled("dom", debug_level::dump, false);
74 debug_set_format("dom", debug_level::info,
75 (debug_get_formats("dom")[debug_level::info]
76 .reset(debug_format::color)
77 .set(debug_format::datetime)
78 ));
79
80
81 const std::string something = "some thing";
82 const char* obj = "obj";
83 const int op = 5;
84
85
86 debug_out_dump("dom", "Dumping something: " << something << std::endl);
87 debug_out_info("dom", "Doing something: " << something << std::endl);
88 debug_out_error("dom", "Error while doing something\n");
89
90 debug_out_info("dom", "Doing something with " << obj << " object\n");
91 debug_out_fatal("dom", "Fatal error while performing operation " << op << "\n");
92
93
94 DBG_ASSERT_MSG(1 == 0, "One does not equal 0");
95 DBG_ASSERT(1 == 0);
96
97 debug_out_dump("default", DBG_POS << "\n");
98 debug_out_dump("default", DBG_POS.func << "\n");
99
100
101 DBG_TRACE_POINT_MSG(1);
102 DBG_TRACE_POINT_MSG(666 a);
103
104 DBG_TRACE_POINT_AUTO;
105 DBG_TRACE_POINT_AUTO;
106
107// Str s;
108// s.somefunc(1, 1);
109
110
111
112 // these begin()/end() turn off prefix printing
113 debug_begin(); // don't use different levels inside, or they might get merged (the order will be different).
114 debug_out_info("default", "The following lines should have no prefixes\n");
115 debug_out_info("default", "1st line\n" << "2nd line\n");
116 debug_out_error("default", "3rd line, error, prefixed\n");
117 debug_out_info("default", debug_indent << "4th line, not prefixed\n");
118 debug_out_warn("default", "5th line, warning, prefixed\n");
119 debug_out_warn("default", "6th line, warning, not prefixed\n");
120 debug_indent_dec(); // or use << debug_unindent
121 debug_end();
122
123 debug_out_info("default", "prefixed\n");
124
125
126

Callers 2

main_exception_wrapperFunction · 0.85
mainFunction · 0.85

Calls 12

debug_register_domainFunction · 0.85
debug_set_enabledFunction · 0.85
debug_set_formatFunction · 0.85
debug_get_formatsFunction · 0.85
debug_beginFunction · 0.85
debug_indent_decFunction · 0.85
debug_endFunction · 0.85
TestClassAClass · 0.85
funcMethod · 0.80
func2Method · 0.80
setMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected