Branch Coverage

src/xs/xlog.cc
Criterion Covered Total %
branch 31 62 50.0


line true false branch
8 0 16 struct PerlSubLogger : ILogger {
12 16 0 PerlSubLogger (const Sub& sub) : fn(xs::in(sub)) {}
15 0 19 if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread");
0 0 if (!is_perl_thread()) throw std::logic_error("can't call pure-perl logging callback: log() called from perl-foreign thread");
20 0 3 struct PerlSubFormatter : IFormatter {
24 3 0 PerlSubFormatter (const Sub& sub) : fn(xs::in(sub)) {}
27 0 7 if (!is_perl_thread()) throw std::logic_error("can't call pure-perl formatting callback: log() called from perl-foreign thread");
0 0 if (!is_perl_thread()) throw std::logic_error("can't call pure-perl formatting callback: log() called from perl-foreign thread");
33 8 0 xs::at_perl_destroy([]{
35 8 0 auto modules = get_modules();
36 14 8 for (auto module : modules) {
37 14 0 if (dyn_cast(module->get_logger().get())) module->set_logger(nullptr);
14 0 if (dyn_cast(module->get_logger().get())) module->set_logger(nullptr);
0 14 if (dyn_cast(module->get_logger().get())) module->set_logger(nullptr);
0 0 if (dyn_cast(module->get_logger().get())) module->set_logger(nullptr);
38 14 0 if (dyn_cast(module->get_formatter().get())) module->set_formatter(nullptr);
14 0 if (dyn_cast(module->get_formatter().get())) module->set_formatter(nullptr);
0 14 if (dyn_cast(module->get_formatter().get())) module->set_formatter(nullptr);
0 0 if (dyn_cast(module->get_formatter().get())) module->set_formatter(nullptr);
40 8 0 });
48 16 51 if (sv.is_sub_ref()) return new PerlSubLogger(sv);
16 0 if (sv.is_sub_ref()) return new PerlSubLogger(sv);
16 0 if (sv.is_sub_ref()) return new PerlSubLogger(sv);
53 3 55 if (sv.is_sub_ref()) return new PerlSubFormatter(sv);
3 0 if (sv.is_sub_ref()) return new PerlSubFormatter(sv);
3 0 if (sv.is_sub_ref()) return new PerlSubFormatter(sv);
54 30 25 if (sv.is_string()) return new PatternFormatter(xs::in(sv));
30 0 if (sv.is_string()) return new PatternFormatter(xs::in(sv));
30 0 if (sv.is_string()) return new PatternFormatter(xs::in(sv));
58 8 0 }
8 0 }