summaryrefslogtreecommitdiff
path: root/lib/common/Logging.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-04-09 22:15:49 +0000
committerChris Wilson <chris+github@qwirx.com>2014-04-09 22:15:49 +0000
commite6fe203cf40a3542cb6949187387f2ab018bc762 (patch)
tree0e16a401e7cd0d4bdf55381634371d784ae10075 /lib/common/Logging.h
parent9a15b3e3157068c3be87dca325abc52ece6e6ff1 (diff)
Refactor logging option processing out of Daemon class.
Allows command-line tools to reuse the same option processing.
Diffstat (limited to 'lib/common/Logging.h')
-rw-r--r--lib/common/Logging.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index d74ded61..7cf9d46c 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -446,6 +446,37 @@ class Logging
Logging::Remove(mpLogger);
}
};
+
+ // --------------------------------------------------------------------------
+ //
+ // Class
+ // Name: Logging::OptionParser
+ // Purpose: Process command-line options
+ // Created: 2014/04/09
+ //
+ // --------------------------------------------------------------------------
+ class OptionParser
+ {
+ public:
+ OptionParser(Log::Level InitialLevel =
+ #ifdef BOX_RELEASE_BUILD
+ Log::NOTICE
+ #else
+ Log::INFO
+ #endif
+ )
+ : mCurrentLevel(InitialLevel)
+ { }
+
+ static std::string GetOptionString();
+ int ProcessOption(signed int option);
+ static std::string GetUsageString();
+ int mCurrentLevel; // need an int to do math with
+ Log::Level GetCurrentLevel()
+ {
+ return (Log::Level) mCurrentLevel;
+ }
+ };
};
class FileLogger : public Logger