diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-12-16 20:27:44 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-12-16 20:27:44 +0000 |
commit | 8b9dbce8c787890b1e74e27a06e3780515c34b65 (patch) | |
tree | 36579e572c21283dcb52291c4a2c3b2a25d26317 /bin/bbackupd/bbackupd.cpp | |
parent | a3c9642a2db8fee585c35da6525be4418f4cc5fd (diff) |
Change all logging to use the logging framework, as an example. (refs #3)
Diffstat (limited to 'bin/bbackupd/bbackupd.cpp')
-rw-r--r-- | bin/bbackupd/bbackupd.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/bbackupd/bbackupd.cpp b/bin/bbackupd/bbackupd.cpp index e00d3628..1ddbf397 100644 --- a/bin/bbackupd/bbackupd.cpp +++ b/bin/bbackupd/bbackupd.cpp @@ -12,6 +12,7 @@ #include "MainHelper.h" #include "BoxPortsAndFiles.h" #include "BackupStoreException.h" +#include "Logging.h" #include "MemLeakFindOn.h" @@ -26,9 +27,17 @@ int main(int argc, const char *argv[]) { MAINHELPER_START -#ifdef WIN32 + Logging::SetProgramName("Box Backup (bbackupd)"); + Logging::ToConsole(true); + Logging::FilterSyslog (Log::EVERYTHING); - ::openlog("Box Backup (bbackupd)", LOG_PID, LOG_LOCAL6); + #ifdef NDEBUG + Logging::FilterConsole(Log::INFO); + #else + Logging::FilterConsole(Log::EVERYTHING); + #endif + +#ifdef WIN32 if(argc == 2 && (::strcmp(argv[1], "--help") == 0 || @@ -56,6 +65,7 @@ int main(int argc, const char *argv[]) if (argc >= 2 && ::strcmp(argv[1], "--service") == 0) { runAsWin32Service = true; + Logging::ToSyslog(true); } gpDaemonService = new Win32BackupService(); @@ -66,7 +76,7 @@ int main(int argc, const char *argv[]) if (runAsWin32Service) { - syslog(LOG_INFO, "Box Backup service starting"); + BOX_INFO("Box Backup service starting"); char* config = NULL; if (argc >= 3) @@ -81,7 +91,7 @@ int main(int argc, const char *argv[]) free(config); } - syslog(LOG_INFO, "Box Backup service shut down"); + BOX_INFO("Box Backup service shut down"); } else { |