summaryrefslogtreecommitdiffstats
path: root/src/Log.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-15 10:01:01 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-15 10:01:01 +0200
commit9642447fb0c7d10e06452d0d153a1a00d7f60a65 (patch)
tree3abe3d881d7fa5a2046f2fbb87cbdf03bec6a636 /src/Log.h
parentee0db2ebbc3e0e9d6a50e8ab3fd108d903afed2a (diff)
downloaddabmux-9642447fb0c7d10e06452d0d153a1a00d7f60a65.tar.gz
dabmux-9642447fb0c7d10e06452d0d153a1a00d7f60a65.tar.bz2
dabmux-9642447fb0c7d10e06452d0d153a1a00d7f60a65.zip
Add discard level to Log
Diffstat (limited to 'src/Log.h')
-rw-r--r--src/Log.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Log.h b/src/Log.h
index 2873818..e14ca37 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -44,10 +44,10 @@
#define SYSLOG_IDENT "ODR-DabMux"
#define SYSLOG_FACILITY LOG_LOCAL0
-enum log_level_t {debug = 0, info, warn, error, alert, emerg};
+enum log_level_t {debug = 0, info, warn, error, alert, emerg, discard};
static const std::string levels_as_str[] =
- { " ", " ", "WARN ", "ERROR", "ALERT", "EMERG"} ;
+ { " ", " ", "WARN ", "ERROR", "ALERT", "EMERG", "-----"} ;
/** Abstract class all backends must inherit from */
class LogBackend {
@@ -166,13 +166,17 @@ class LogLine {
// Push the new element into the stringstream
template <typename T>
LogLine& operator<<(T s) {
- os << s;
+ if (level_ != discard) {
+ os << s;
+ }
return *this;
}
~LogLine()
{
- logger_->logstr(level_, os.str());
+ if (level_ != discard) {
+ logger_->logstr(level_, os.str());
+ }
}
private: