summaryrefslogtreecommitdiff
path: root/lib/server/Daemon.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-04-22 14:25:08 +0000
committerChris Wilson <chris+github@qwirx.com>2007-04-22 14:25:08 +0000
commit35e9013d1a108a186908ef1e6ee3f26f9407c5f1 (patch)
treee4545c7e6369f4c1e067779449540f984541f8fa /lib/server/Daemon.cpp
parent6ecbc1c1c5eac92fce40bc931ffb953f1d7a5d1d (diff)
Add -V option, which sets maximum verbosity in one go.
Add -T option, which adds timestamps to console logs. Add -t option, which enabled and sets the tag used on console logs. Add -k option, which keeps console open after forking. (refs #3)
Diffstat (limited to 'lib/server/Daemon.cpp')
-rw-r--r--lib/server/Daemon.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/lib/server/Daemon.cpp b/lib/server/Daemon.cpp
index 5ee45378..c639309a 100644
--- a/lib/server/Daemon.cpp
+++ b/lib/server/Daemon.cpp
@@ -51,7 +51,8 @@ Daemon *Daemon::spDaemon = 0;
Daemon::Daemon()
: mpConfiguration(NULL),
mReloadConfigWanted(false),
- mTerminateWanted(false)
+ mTerminateWanted(false),
+ mKeepConsoleOpenAfterFork(false)
{
if(spDaemon != NULL)
{
@@ -109,8 +110,9 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
#endif
char c;
+ optind = 0; // just in case anybody used getopt before
- while((c = getopt(argc, (char * const *)argv, "c:Dqv")) != -1)
+ while((c = getopt(argc, (char * const *)argv, "c:DqvVt:Tk")) != -1)
{
switch(c)
{
@@ -153,10 +155,34 @@ int Daemon::Main(const char *DefaultConfigFile, int argc, const char *argv[])
}
break;
+ case 'V':
+ {
+ masterLevel = Log::EVERYTHING;
+ }
+ break;
+
+ case 't':
+ {
+ Console::SetTag(optarg);
+ }
+ break;
+
+ case 'T':
+ {
+ Console::SetShowTime(true);
+ }
+ break;
+
+ case 'k':
+ {
+ mKeepConsoleOpenAfterFork = true;
+ }
+ break;
+
case '?':
{
BOX_FATAL("Unknown option on command line: "
- << "'" << optopt << "'");
+ << "'" << (char)optopt << "'");
return 2;
}
break;
@@ -377,7 +403,7 @@ int Daemon::Main(const std::string &rConfigFileName, bool singleProcess)
}
#endif // BOX_MEMORY_LEAK_TESTING
- if(asDaemon)
+ if(asDaemon && !mKeepConsoleOpenAfterFork)
{
#ifndef WIN32
// Close standard streams