/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ // WARNING : pragma commands to hide boost warning // TODO : remove these pragma commands when boost will fix this issue in future release #if defined(__clang__) _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\"") #include "logger.h" _Pragma("clang diagnostic pop") #elif defined(__GNUC__) || defined(__GNUG__) _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wshadow\"") #include "logger.h" _Pragma("GCC diagnostic pop") #endif #include void test_logger() { LOG(TRACE) << "this is a trace message"; LOG(DEBUG) << "this is a debug message"; LOG(RESULTS) << "this is a results message"; LOG(INFO) << "this is a info message"; LOG(WARN) << "this is a warning message"; LOG(ERROR) << "this is an error message"; LOG(STATE) << "this is a state message"; } void test_console_level() { std::cout<<"********* test logger : SET_LOG_CONSOLE_LEVEL(lvl) *********"<(); // return (sev == FairMQ::ERROR); // }, // boost::log::keywords::file_name = "test_log3_%5N.log", // boost::log::keywords::rotation_size = 5 * 1024 * 1024, // boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(12, 0, 0) // ); test_logger(); std::cout << "----------------------------"<set_filter([](const boost::log::attribute_value_set& attr_set) { auto sev = attr_set["Severity"].extract(); return (sev == FairMQ::WARN) || (sev == FairMQ::ERROR); }); test_logger(); // remove all sinks, and restart console sinks ReinitLogger(false); test_logger(); return 0; }