diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-20 16:27:36 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-20 16:27:36 +0200 |
commit | 9d06c2ebc1ab5376eced52a6437d64c576915543 (patch) | |
tree | 47e533f0f409b2de76cd6aae58d7250ddfeb1d70 | |
parent | ae42b9c012e10972eb1e666d9d17d4903940b906 (diff) | |
download | ble-toys-9d06c2ebc1ab5376eced52a6437d64c576915543.tar.gz ble-toys-9d06c2ebc1ab5376eced52a6437d64c576915543.tar.bz2 ble-toys-9d06c2ebc1ab5376eced52a6437d64c576915543.tar.xz ble-toys-9d06c2ebc1ab5376eced52a6437d64c576915543.zip |
o Configuring better logging output.
-rw-r--r-- | apps/apps.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/apps.cpp b/apps/apps.cpp index 80fae13..b9ee81c 100644 --- a/apps/apps.cpp +++ b/apps/apps.cpp @@ -1,5 +1,7 @@ #include "apps.h" #include <log4cplus/logger.h> +#include <log4cplus/consoleappender.h> +#include <log4cplus/layout.h> #include <log4cplus/configurator.h> #include <netdb.h> @@ -17,8 +19,12 @@ const po::options_description logging_options() { } void setup_logging(po::variables_map vm) { - BasicConfigurator config; - config.configure(); + Appender *console = new ConsoleAppender(true, true); + PatternLayout* layout = new PatternLayout(LOG4CPLUS_TEXT("%-5p %r %-20c %m%n")); + console->setLayout(auto_ptr<Layout>(layout)); + + Hierarchy &h = Logger::getDefaultHierarchy(); + h.getRoot().addAppender(SharedAppenderPtr(console)); } int launch_app(int argc, char *argv[], app &app) { |