From 1738144097ae05ebd8063976fb48db931f551ff5 Mon Sep 17 00:00:00 2001 From: g0dil <g0dil@wiback.org> Date: Wed, 7 Nov 2007 11:59:18 +0000 Subject: [PATCH] Utils/Logger; Small documentation fix Utils: Catch exceptions in senf::Daemin in non-debug build --- Utils/DaemonTools.cc | 22 ++++++++++++++++++++++ Utils/Logger/Config.hh | 11 ++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Utils/DaemonTools.cc b/Utils/DaemonTools.cc index c8fe63e5a..1896a5c09 100644 --- a/Utils/DaemonTools.cc +++ b/Utils/DaemonTools.cc @@ -87,12 +87,29 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv) argc_ = argc; argv_ = argv; +# ifdef NDEBUG + try { +# endif + configure(); if (daemonize_) fork(); if (! pidfile_.empty()) pidfileCreate(); main(); + +# ifdef NDEBUG + } + catch (std::exception & e) { + std::cerr << "\n*** Fatal exception: " << e.what() << std::endl; + return 1; + } + catch (...) { + std::cerr << "\n*** Fatal exception: (unknown)" << std::endl; + return 1; + } +# endif + return 0; } @@ -123,6 +140,11 @@ prefix_ void senf::Daemon::init() prefix_ void senf::Daemon::run() {} +prefix_ void senf::Daemon::fork() +{ + +} + prefix_ void senf::Daemon::pidfileCreate() {} diff --git a/Utils/Logger/Config.hh b/Utils/Logger/Config.hh index 4ffb5ac9b..8e0eda33f 100644 --- a/Utils/Logger/Config.hh +++ b/Utils/Logger/Config.hh @@ -71,7 +71,7 @@ The runtime configuration is performed by routing messages to one or more logging targets: \code - senf::log::ConsoleLog consoleLog; + senf::log::ConsoleLog & consoleLog (senf::log::ConsoleLog::instance()); senf::log::FileLog fileLog ("my.log"); consoleLog.route<senf::log::Debug>(); @@ -79,10 +79,11 @@ consoleLog.route<foo::Transactions, senf::log::IMPORTANT>(); fileLog.route<foo::Transactions>(); - \endcode Here we see an already relatively complex setup: All debug messages (that is, those, - which are not disabled at compile time) are routed to the console. We also route important - transactions to the console \e except transactions from the \c foo::SomeClass area. The \c - fileLog simply receives all transaction log messages. + \endcode + Here we see an already relatively complex setup: All debug messages (that is, those, which are + not disabled at compile time) are routed to the console. We also route important transactions to + the console \e except transactions from the \c foo::SomeClass area. The \c fileLog simply + receives all transaction log messages. The routing statements are processed by the targets in order, the first matching rule will decide a log messages fate for that target. -- GitLab