summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Herchet <frank.fh.herchet@bmw.de>2012-02-29 14:14:26 +0100
committerFrank Herchet <frank.fh.herchet@bmw.de>2012-02-29 14:14:26 +0100
commit9c703b74e66c33a68f7013f21cf198d242475ba1 (patch)
treeaeddbfdb8d4944f7d359b2911bc28e212f8487ed
parent70c815798674609aee710a29667293c1f49a0df3 (diff)
downloadaudiomanager-9c703b74e66c33a68f7013f21cf198d242475ba1.tar.gz
* add command line argument "-V: print DLT logs to stdout" if compile flag WITH_DLT undefined
-rw-r--r--AudioManagerDaemon/src/main.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/AudioManagerDaemon/src/main.cpp b/AudioManagerDaemon/src/main.cpp
index dee5edb..5020a1f 100644
--- a/AudioManagerDaemon/src/main.cpp
+++ b/AudioManagerDaemon/src/main.cpp
@@ -72,6 +72,9 @@ const char* USAGE_DESCRIPTION = "Usage:\tAudioManagerDaemon [options]\n"
"\t-h: print this message\t\n"
"\t-i: info about current settings \t\n"
"\t-v: print version\t\n"
+#ifndef WITH_DLT
+ "\t-V: print DLT logs to stdout\t\n"
+#endif
"\t-d: daemonize AudioManager \t\n"
"\t-p<path> path for sqlite database (default is in memory)\t\n"
"\t-t<port> port for telnetconnection\t\n"
@@ -89,6 +92,7 @@ std::string databasePath = std::string(":memory:");
unsigned int telnetport = DEFAULT_TELNETPORT;
unsigned int maxConnections = MAX_TELNETCONNECTIONS;
int fd0, fd1, fd2;
+bool enableNoDLTDebug = false;
void OutOfMemoryHandler()
{
@@ -149,7 +153,11 @@ void parseCommandLine(int argc, char **argv)
{
while (optind < argc)
{
+#ifdef WITH_DLT
int option = getopt(argc, argv, "h::v::c::l::r::L::R::d::t::m::i::p::");
+#else
+ int option = getopt(argc, argv, "h::v::V::c::l::r::L::R::d::t::m::i::p::");
+#endif
switch (option)
{
@@ -202,6 +210,12 @@ void parseCommandLine(int argc, char **argv)
printf("AudioManagerDaemon Version: %s\n", DAEMONVERSION);
exit(-1);
break;
+#ifndef WITH_DLT
+ case 'V':
+ printf("[DLT] debug output to stdout enabled\n");
+ enableNoDLTDebug = true;
+ break;
+#endif
case 'h':
default:
printf("AudioManagerDaemon Version: %s\n", DAEMONVERSION);
@@ -225,17 +239,17 @@ static void signalHandler(int sig, siginfo_t *siginfo, void *context)
int main(int argc, char *argv[])
{
- DLTWrapper::instance()->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
- DLTWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
- logInfo("The Audiomanager is started");
- log(&AudioManager, DLT_LOG_ERROR, "The version of the Audiomanager", DAEMONVERSION);
-
listCommandPluginDirs.push_back(std::string(DEFAULT_PLUGIN_COMMAND_DIR));
listRoutingPluginDirs.push_back(std::string(DEFAULT_PLUGIN_ROUTING_DIR));
//parse the commandline options
parseCommandLine(argc, (char**) argv);
+ DLTWrapper::instance(enableNoDLTDebug)->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
+ DLTWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
+ logInfo("The Audiomanager is started");
+ log(&AudioManager, DLT_LOG_ERROR, "The version of the Audiomanager", DAEMONVERSION);
+
//now the signal handler:
struct sigaction signalAction;
memset(&signalAction, '\0', sizeof(signalAction));