Skip to content
Snippets Groups Projects
Commit 17381440 authored by g0dil's avatar g0dil
Browse files

Utils/Logger; Small documentation fix

Utils: Catch exceptions in senf::Daemin in non-debug build
parent 81653a87
No related branches found
No related tags found
No related merge requests found
...@@ -87,12 +87,29 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv) ...@@ -87,12 +87,29 @@ prefix_ int senf::Daemon::start(int argc, char const ** argv)
argc_ = argc; argc_ = argc;
argv_ = argv; argv_ = argv;
# ifdef NDEBUG
try {
# endif
configure(); configure();
if (daemonize_) if (daemonize_)
fork(); fork();
if (! pidfile_.empty()) if (! pidfile_.empty())
pidfileCreate(); pidfileCreate();
main(); 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; return 0;
} }
...@@ -123,6 +140,11 @@ prefix_ void senf::Daemon::init() ...@@ -123,6 +140,11 @@ prefix_ void senf::Daemon::init()
prefix_ void senf::Daemon::run() prefix_ void senf::Daemon::run()
{} {}
prefix_ void senf::Daemon::fork()
{
}
prefix_ void senf::Daemon::pidfileCreate() prefix_ void senf::Daemon::pidfileCreate()
{} {}
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
The runtime configuration is performed by routing messages to one or more logging targets: The runtime configuration is performed by routing messages to one or more logging targets:
\code \code
senf::log::ConsoleLog consoleLog; senf::log::ConsoleLog & consoleLog (senf::log::ConsoleLog::instance());
senf::log::FileLog fileLog ("my.log"); senf::log::FileLog fileLog ("my.log");
consoleLog.route<senf::log::Debug>(); consoleLog.route<senf::log::Debug>();
...@@ -79,10 +79,11 @@ ...@@ -79,10 +79,11 @@
consoleLog.route<foo::Transactions, senf::log::IMPORTANT>(); consoleLog.route<foo::Transactions, senf::log::IMPORTANT>();
fileLog.route<foo::Transactions>(); fileLog.route<foo::Transactions>();
\endcode Here we see an already relatively complex setup: All debug messages (that is, those, \endcode
which are not disabled at compile time) are routed to the console. We also route important Here we see an already relatively complex setup: All debug messages (that is, those, which are
transactions to the console \e except transactions from the \c foo::SomeClass area. The \c not disabled at compile time) are routed to the console. We also route important transactions to
fileLog simply receives all transaction log messages. 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 The routing statements are processed by the targets in order, the first matching rule will
decide a log messages fate for that target. decide a log messages fate for that target.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment