diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-17 19:08:12 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-17 19:11:34 +0100 |
commit | e6a0ca2d1442eb6a9e54fe631652c7ac8066d6ba (patch) | |
tree | 730c1ca07118154980d97ef4563a30b87b3387ae | |
parent | af9f0e612d0290d4d909c16d8f7877e7cc1c565f (diff) | |
download | dabmux-e6a0ca2d1442eb6a9e54fe631652c7ac8066d6ba.tar.gz dabmux-e6a0ca2d1442eb6a9e54fe631652c7ac8066d6ba.tar.bz2 dabmux-e6a0ca2d1442eb6a9e54fe631652c7ac8066d6ba.zip |
improve logging
-rw-r--r-- | src/DabMux.cpp | 22 | ||||
-rw-r--r-- | src/Log.cpp | 11 |
2 files changed, 17 insertions, 16 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp index b735cf7..f3edd39 100644 --- a/src/DabMux.cpp +++ b/src/DabMux.cpp @@ -362,16 +362,11 @@ int main(int argc, char *argv[]) } + etiLog.log(info, "CRC-DABMUX starting up"); if (outputs.size() == 0) { - etiLog.log(warn, "no output defined\n"); - - // initialise a new dabOutput - outputs.push_back(new dabOutput("simul", NULL)); - output = outputs.end() - 1; - - printf("Press enter to continue\n"); - getchar(); + etiLog.log(emerg, "no output defined"); + goto EXIT; } // Check and adjust subchannels @@ -606,22 +601,21 @@ int main(int argc, char *argv[]) memset(etiFrame, 0, 6144); // Print settings before starting - etiLog.log(info, "\n--- Multiplex configuration ---\n"); + etiLog.log(info, "--- Multiplex configuration ---"); printEnsemble(ensemble); - etiLog.log(info, "\n--- Subchannels list ---\n"); + etiLog.log(info, "--- Subchannels list ---"); printSubchannels(ensemble->subchannels); - etiLog.log(info, "\n--- Services list ---\n"); + etiLog.log(info, "--- Services list ---"); printServices(ensemble->services); - etiLog.log(info, "\n--- Components list ---\n"); + etiLog.log(info, "--- Components list ---"); printComponents(ensemble->components); - etiLog.log(info, "\n--- Output list ---\n"); + etiLog.log(info, "--- Output list ---"); printOutputs(outputs); - etiLog.log(info, "\n"); /*************************************************************************** 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; } |