diff options
Diffstat (limited to 'src/Log.cpp')
-rw-r--r-- | src/Log.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Log.cpp b/src/Log.cpp index 7817243..30cc1f7 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -59,15 +59,22 @@ void Logger::log(log_level_t level, const char* fmt, ...) logstr(level, str); } -void Logger::logstr(log_level_t level, const std::string message) +void Logger::logstr(log_level_t level, std::string message) { + /* Remove a potential trailing newline. + * It doesn't look good in syslog + */ + if (message[message.length()-1] == '\n') { + message.resize(message.length()-1); + } + for (std::list<LogBackend*>::iterator it = backends.begin(); it != backends.end(); it++) { (*it)->log(level, message); } - std::cerr << levels_as_str[level] << " " << message; + std::cerr << levels_as_str[level] << " " << message << std::endl; } |