/** * Copyright - See the COPYRIGHT that is included with this distribution. * pvxs is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ #include #include #include #include #include namespace pvxs { std::ostream& operator<<(std::ostream& strm, Level lvl) { switch (lvl) { #define CASE(NAME) case Level::NAME: strm<<#NAME; break CASE(Crit); CASE(Err); CASE(Warn); CASE(Info); CASE(Debug); #undef CASE } return strm; } } // namespace pvxs using namespace pvxs; namespace { DEFINE_LOGGER(loggera, "test.a"); DEFINE_LOGGER(loggerb, "test.b"); void testLog() { testDiag("%s", __func__); testTrue(loggera.test(Level::Warn)); testEq(loggera.lvl.load(), Level::Warn); logger_level_set("test.*", Level::Err); testEq(loggera.lvl.load(), Level::Err); testTrue(loggerb.test(Level::Err)); testEq(loggerb.lvl.load(), Level::Err); logger_level_set("test.*", Level::Info); testEq(loggera.lvl.load(), Level::Info); testEq(loggerb.lvl.load(), Level::Info); logger_level_set("test.a", Level::Err); testEq(loggera.lvl.load(), Level::Err); testEq(loggerb.lvl.load(), Level::Info); logger_level_set("test.*", Level::Warn); testEq(loggera.lvl.load(), Level::Warn); testEq(loggerb.lvl.load(), Level::Warn); logger_level_clear(); logger_level_set("test.*", Level::Err); testEq(loggera.lvl.load(), Level::Err); testEq(loggerb.lvl.load(), Level::Err); } } // namespace MAIN(testlog) { testPlan(13); testSetup(); testLog(); return testDone(); }