diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-20 16:44:57 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-06-20 16:44:57 +0200 |
commit | ff6b859c52ad670b3db08e11209dc6833e894611 (patch) | |
tree | 694d60baf29854c0c26e98f5db134526613a3b55 /apps/apps.h | |
parent | c7221b3666badbcf016e33997449e74778d979a9 (diff) | |
download | ble-toys-ff6b859c52ad670b3db08e11209dc6833e894611.tar.gz ble-toys-ff6b859c52ad670b3db08e11209dc6833e894611.tar.bz2 ble-toys-ff6b859c52ad670b3db08e11209dc6833e894611.tar.xz ble-toys-ff6b859c52ad670b3db08e11209dc6833e894611.zip |
o Adding app_name to app, creating a per-app logger.
Diffstat (limited to 'apps/apps.h')
-rw-r--r-- | apps/apps.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/apps.h b/apps/apps.h index 727e554..8173c51 100644 --- a/apps/apps.h +++ b/apps/apps.h @@ -1,6 +1,8 @@ #pragma once #include <boost/program_options.hpp> +#include <log4cplus/logger.h> +#include <log4cplus/loggingmacros.h> namespace trygvis { namespace apps { @@ -20,6 +22,9 @@ public: class app { public: + app(std::string app_name): _app_name(app_name), logger(log4cplus::Logger::getInstance(LOG4CPLUS_TEXT(app_name))) { + } + virtual ~app() = default; virtual void add_options(po::options_description_easy_init &options) { }; @@ -28,6 +33,10 @@ public: }; virtual int main(app_execution &execution) = 0; + +protected: + const std::string _app_name; + const log4cplus::Logger logger; }; int launch_app(int argc, char *argv[], app &app); |