From 4fa3c3650594a429b65a747d8b55d1f7a702949e Mon Sep 17 00:00:00 2001 From: Jamie Hanlon Date: Sun, 20 Feb 2022 08:57:35 +0000 Subject: [PATCH] Rename methods for setting logging level --- include/netlist_paths/Options.hpp | 10 +++++----- lib/netlist_paths/python_wrapper.cpp | 6 ++++-- tests/unit/VerilatorXMLTests.cpp | 4 ++-- tools/netlist-paths/main.cpp | 4 ++-- tools/netlist_paths.py | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/netlist_paths/Options.hpp b/include/netlist_paths/Options.hpp index 1bbef5e..c99c316 100644 --- a/include/netlist_paths/Options.hpp +++ b/include/netlist_paths/Options.hpp @@ -83,22 +83,22 @@ class Options { void setErrorOnUnmatchedNode(bool value) { errorOnUnmatchedNode = value; } /// Enable verbose output. - void setVerbose() { + void setLoggingVerbose() { boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::info); } /// Enable debug output (including verbose messages). - void setDebug() { + void setLoggingDebug() { boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug); } /// Supress verbose and debug messages. - void setQuiet() { + void setLoggingQuiet() { boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning); } /// Supress warning, verbose and debug messages. - void setNoWarnings() { + void setLoggingErrorOnly() { boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::error); } @@ -128,7 +128,7 @@ class Options { errorOnUnmatchedNode(false) { // Setup logging. boost::log::add_console_log(std::clog, boost::log::keywords::format = "%Severity%: %Message%"); - setQuiet(); + setLoggingQuiet(); } public: diff --git a/lib/netlist_paths/python_wrapper.cpp b/lib/netlist_paths/python_wrapper.cpp index 7ba35e1..86f4cad 100644 --- a/lib/netlist_paths/python_wrapper.cpp +++ b/lib/netlist_paths/python_wrapper.cpp @@ -103,8 +103,10 @@ BOOST_PYTHON_MODULE(py_netlist_paths) .def("get_instance", &Options::getInstancePtr, return_value_policy()) .staticmethod("get_instance") - .def("set_verbose", &Options::setVerbose) - .def("set_debug", &Options::setDebug) + .def("set_logging_verbose", &Options::setLoggingVerbose) + .def("set_logging_debug", &Options::setLoggingDebug) + .def("set_logging_quiet", &Options::setLoggingQuiet) + .def("set_logging_error_only", &Options::setLoggingErrorOnly) .def("set_match_exact", &Options::setMatchExact) .def("set_match_wildcard", &Options::setMatchWildcard) .def("set_match_regex", &Options::setMatchRegex) diff --git a/tests/unit/VerilatorXMLTests.cpp b/tests/unit/VerilatorXMLTests.cpp index 8eb1298..6155c03 100644 --- a/tests/unit/VerilatorXMLTests.cpp +++ b/tests/unit/VerilatorXMLTests.cpp @@ -54,10 +54,10 @@ BOOST_AUTO_TEST_CASE(assign_alias_regs) { /// have a corresponding variable declaration in a varscope. See /// https://github.com/jameshanlon/netlist-paths/issues/7 BOOST_AUTO_TEST_CASE(var_no_scope) { - netlist_paths::Options::getInstance().setNoWarnings(); // Supress warning about missing scope. + netlist_paths::Options::getInstance().setLoggingErrorOnly(); // Supress warning about missing scope. BOOST_CHECK_NO_THROW(compile("var_no_scope.sv")); BOOST_TEST(!np->isEmpty()); - netlist_paths::Options::getInstance().setQuiet(); + netlist_paths::Options::getInstance().setLoggingQuiet(); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/tools/netlist-paths/main.cpp b/tools/netlist-paths/main.cpp index dd67c90..01fbe40 100644 --- a/tools/netlist-paths/main.cpp +++ b/tools/netlist-paths/main.cpp @@ -78,10 +78,10 @@ int main(int argc, char **argv) { po::store(po::command_line_parser(argc, argv). options(allOptions).positional(p).run(), vm); if (vm.count("debug") > 0) { - netlist_paths::Options::getInstance().setDebug(); + netlist_paths::Options::getInstance().setLoggingDebug(); } if (vm.count("verbose") > 0) { - netlist_paths::Options::getInstance().setVerbose(); + netlist_paths::Options::getInstance().setLoggingVerbose(); } bool displayHelp = vm.count("help") > 0; bool compile = vm.count("compile") > 0; diff --git a/tools/netlist_paths.py b/tools/netlist_paths.py index d1bed98..9a7edda 100644 --- a/tools/netlist_paths.py +++ b/tools/netlist_paths.py @@ -234,12 +234,12 @@ def main(): help='Ignore hierarchy markers: _ . /') parser.add_argument('-v', '--verbose', action='store_const', - const=lambda: Options.get_instance().set_verbose(), + const=lambda: Options.get_instance().set_logging_verbose(), default=lambda *args: None, help='Print execution information') parser.add_argument('-d', '--debug', action='store_const', - const=lambda: Options.get_instance().set_debug(), + const=lambda: Options.get_instance().set_logging_debug(), default=lambda *args: None, help='Print debugging information') args = parser.parse_args()