summaryrefslogtreecommitdiffstats
path: root/src/bin/lfc/lfc_controller.cc
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2015-02-14 02:43:28 +0100
committerShawn Routhier <sar@isc.org>2015-02-14 02:43:28 +0100
commit59e1089ffafdacc665a3c4ba92beb11bddb19028 (patch)
treeda9a258b4d70f94e9820f9f2ca1261d6e477738b /src/bin/lfc/lfc_controller.cc
parent[trac3667] Untabify (diff)
downloadkea-59e1089ffafdacc665a3c4ba92beb11bddb19028.tar.xz
kea-59e1089ffafdacc665a3c4ba92beb11bddb19028.zip
[trac3667] Updates per review
Move lease_stats.h to leae_file_stats.h Move logging init code into its own function.
Diffstat (limited to 'src/bin/lfc/lfc_controller.cc')
-rw-r--r--src/bin/lfc/lfc_controller.cc67
1 files changed, 37 insertions, 30 deletions
diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc
index f4430e3bd9..4cf18065fe 100644
--- a/src/bin/lfc/lfc_controller.cc
+++ b/src/bin/lfc/lfc_controller.cc
@@ -77,37 +77,9 @@ LFCController::launch(int argc, char* argv[], const bool test_mode) {
usage(ex.what());
throw; // rethrow it
}
- // If we are running in test mode use the environment variables
- // else use our defaults
- if (test_mode) {
- initLogger();
- }
- else {
- OutputOption option;
- LoggerManager manager;
-
- initLogger(lfc_app_name_, INFO, 0, NULL, false);
-
- // Prepare the objects to define the logging specification
- LoggerSpecification spec(getRootLoggerName(),
- keaLoggerSeverity(INFO),
- keaLoggerDbglevel(0));
-
- // If we are running in verbose (debugging) mode
- // we send the output to the console, otherwise
- // by default we send it to the SYSLOG
- if (verbose_) {
- option.destination = OutputOption::DEST_CONSOLE;
- } else {
- option.destination = OutputOption::DEST_SYSLOG;
-
- }
-
- // ... and set the destination
- spec.addOutputOption(option);
- manager.process(spec);
- }
+ // Start up the logging system.
+ startLogger(test_mode);
LOG_INFO(lfc_logger, LFC_START);
@@ -419,5 +391,40 @@ LFCController::fileRotate() const {
<< ") error: " << strerror(errno));
}
}
+
+void
+LFCController::startLogger(const bool test_mode) const {
+ // If we are running in test mode use the environment variables
+ // else use our defaults
+ if (test_mode) {
+ initLogger();
+ }
+ else {
+ OutputOption option;
+ LoggerManager manager;
+
+ initLogger(lfc_app_name_, INFO, 0, NULL, false);
+
+ // Prepare the objects to define the logging specification
+ LoggerSpecification spec(getRootLoggerName(),
+ keaLoggerSeverity(INFO),
+ keaLoggerDbglevel(0));
+
+ // If we are running in verbose (debugging) mode
+ // we send the output to the console, otherwise
+ // by default we send it to the SYSLOG
+ if (verbose_) {
+ option.destination = OutputOption::DEST_CONSOLE;
+ } else {
+ option.destination = OutputOption::DEST_SYSLOG;
+ }
+
+ // ... and set the destination
+ spec.addOutputOption(option);
+
+ manager.process(spec);
+ }
+}
+
}; // namespace isc::lfc
}; // namespace isc