aboutsummaryrefslogtreecommitdiffstats
path: root/src/Log.cpp
diff options
context:
space:
mode:
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";