summaryrefslogtreecommitdiffstats
path: root/src
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
parentc891dcf590505565de3de7684980b91638b29484 (diff)
downloaddabmod-0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e.tar.gz
dabmod-0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e.tar.bz2
dabmod-0b36f44c7bf0d8fc0a230c9acdc480cbd3965e5e.zip
Don't send trace logs to syslog
Diffstat (limited to 'src')
-rw-r--r--src/Log.cpp25
-rw-r--r--src/Log.h23
2 files changed, 29 insertions, 19 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";
diff --git a/src/Log.h b/src/Log.h
index 799ca85..d6cd651 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -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.
@@ -70,23 +73,7 @@ class LogToSyslog : public LogBackend {
closelog();
}
- void log(log_level_t level, std::string message) {
-
- 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());
- }
+ void log(log_level_t level, std::string message);
std::string get_name() { return name; }