summaryrefslogtreecommitdiff
path: root/compiler/luci/log/src/Log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/luci/log/src/Log.cpp')
-rw-r--r--compiler/luci/log/src/Log.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/compiler/luci/log/src/Log.cpp b/compiler/luci/log/src/Log.cpp
index c26bf307b..27049bef9 100644
--- a/compiler/luci/log/src/Log.cpp
+++ b/compiler/luci/log/src/Log.cpp
@@ -33,11 +33,6 @@ namespace
*/
template <typename T> T safecast(const char *, const T &);
-template <> bool safecast<bool>(const char *s, const bool &value)
-{
- return (s == nullptr) ? value : (std::stoi(s) != 0);
-}
-
template <> int safecast<int>(const char *s, const int &value)
{
return (s == nullptr) ? value : std::stoi(s);
@@ -68,9 +63,6 @@ LoggerConfig::LoggerConfig()
_show_warn = !settings->get(luci::UserSettings::Key::MuteWarnings);
- // Turn on info logging if LUCI_LOG is set as non-zero value
- _show_info = safecast<bool>(std::getenv("LUCI_LOG"), false);
-
// Turn on verbose logging if LUCI_LOG is set to some level
// VERBOSE(l, 1) will be visible with LUCI_LOG=2 and VERBOSE(l, 2) with LUCI_LOG=3 and so on
_show_verbose = safecast<int>(std::getenv("LUCI_LOG"), 0);
@@ -87,25 +79,15 @@ void LoggerConfig::configure(const hermes::Source *source, hermes::Source::Setti
void LoggerConfig::configure(const Logger *, hermes::Source::Setting &setting) const
{
- setting.filter(hermes::SeverityCategory::FATAL).reject_all();
- setting.filter(hermes::SeverityCategory::ERROR).reject_all();
- setting.filter(hermes::SeverityCategory::WARN).reject_all();
- setting.filter(hermes::SeverityCategory::INFO).reject_all();
- setting.filter(hermes::SeverityCategory::VERBOSE).reject_all();
-
- // TODO enable FATAL and ERROR
+ setting.reject_all();
+ setting.filter(hermes::SeverityCategory::FATAL).accept_upto(_show_verbose);
+ setting.filter(hermes::SeverityCategory::ERROR).accept_upto(_show_verbose);
if (_show_warn)
{
- setting.filter(hermes::SeverityCategory::WARN).accept_all();
- }
- if (_show_info)
- {
- setting.filter(hermes::SeverityCategory::INFO).accept_all();
- }
- if (_show_verbose)
- {
- setting.filter(hermes::SeverityCategory::VERBOSE).accept_upto(_show_verbose);
+ setting.filter(hermes::SeverityCategory::WARN).accept_upto(_show_verbose);
}
+ setting.filter(hermes::SeverityCategory::INFO).accept_upto(_show_verbose);
+ setting.filter(hermes::SeverityCategory::VERBOSE).accept_upto(_show_verbose);
}
} // namespace luci