summaryrefslogtreecommitdiffstats
path: root/src/Log.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-09-18 16:55:37 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-09-18 16:55:37 +0200
commit0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e (patch)
tree8636ed47a347a64652ae215282bdb0a2aa4afa72 /src/Log.cpp
parentc891dcf590505565de3de7684980b91638b29484 (diff)
downloaddabmod-0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e.tar.gz
dabmod-0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e.tar.bz2
dabmod-0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e.zip
Don't send trace logs to syslog
Diffstat (limited to 'src/Log.cpp')
-rw-r--r--src/Log.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/Log.cpp b/src/Log.cpp
index 81f32a8..155fc00 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -3,7 +3,10 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C), 2016, Matthias P. Braendli, matthias.braendli@mpb.li
+ Copyright (C) 2016
+ Matthias P. Braendli, matthias.braendli@mpb.li
+
+ http://opendigitalradio.org
*/
/*
This file is part of ODR-DabMod.
@@ -124,6 +127,26 @@ void LogToFile::log(log_level_t level, std::string message)
}
}
+void LogToSyslog::log(log_level_t level, std::string message)
+{
+ if (level != log_level_t::trace) {
+ int syslog_level = LOG_EMERG;
+ switch (level) {
+ case trace: break; // Do not handle TRACE in syslog
+ case debug: syslog_level = LOG_DEBUG; break;
+ case info: syslog_level = LOG_INFO; break;
+ /* we don't have the notice level */
+ case warn: syslog_level = LOG_WARNING; break;
+ case error: syslog_level = LOG_ERR; break;
+ default: syslog_level = LOG_CRIT; break;
+ case alert: syslog_level = LOG_ALERT; break;
+ case emerg: syslog_level = LOG_EMERG; break;
+ }
+
+ syslog(syslog_level, SYSLOG_IDENT " %s", message.c_str());
+ }
+}
+
LogTracer::LogTracer(const string& trace_filename)
{
name = "TRACE";