A separate function is needed to avoid clang-tidy complaining about capturing __function__ from lambda.
| 67 | |
| 68 | /// A separate function is needed to avoid clang-tidy complaining about capturing __function__ from lambda. |
| 69 | int 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 |
no test coverage detected