add hidden debug log option

This commit is contained in:
badaix 2017-07-24 21:18:39 +02:00
parent 74de3f49ec
commit 72cb5a0e7e
2 changed files with 6 additions and 2 deletions

View file

@ -81,6 +81,7 @@ int main (int argc, char **argv)
int processPriority(-3);
Switch helpSwitch("", "help", "produce help message");
Switch debugSwitch("", "debug", "enable debug logging");
Switch versionSwitch("v", "version", "show version number");
Switch listSwitch("l", "list", "list pcm devices");
Value<string> hostValue("h", "host", "server hostname or ip address", "", &host);
@ -94,6 +95,7 @@ int main (int argc, char **argv)
OptionParser op("Allowed options");
op.add(helpSwitch)
.add(debugSwitch, hidden)
.add(versionSwitch)
.add(hostValue)
.add(portValue)
@ -155,7 +157,7 @@ int main (int argc, char **argv)
Log::init(
{
make_shared<LogSinkCout>(LogPriority::info, LogSink::Type::all), //, "%Y-%m-%d %H-%M-%S [#prio]"),
make_shared<LogSinkCout>(debugSwitch.isSet()?(LogPriority::debug):(LogPriority::info), LogSink::Type::all, debugSwitch.isSet()?"%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)":"%Y-%m-%d %H-%M-%S [#prio]"),
make_shared<LogSinkNative>("snapclient", LogPriority::debug, LogSink::Type::special)
}
);

View file

@ -60,6 +60,7 @@ int main(int argc, char* argv[])
int processPriority(0);
Switch helpSwitch("h", "help", "Produce help message");
Switch debugSwitch("", "debug", "enable debug logging");
Switch versionSwitch("v", "version", "Show version number");
Value<size_t> portValue("p", "port", "Server port", settings.port, &settings.port);
Value<size_t> controlPortValue("", "controlPort", "Remote control port", settings.controlPort, &settings.controlPort);
@ -76,6 +77,7 @@ int main(int argc, char* argv[])
OptionParser op("Allowed options");
op.add(helpSwitch)
.add(debugSwitch, hidden)
.add(versionSwitch)
.add(portValue)
.add(controlPortValue)
@ -143,7 +145,7 @@ int main(int argc, char* argv[])
Log::init(
{
make_shared<LogSinkCout>(LogPriority::info, LogSink::Type::all), //, "%Y-%m-%d %H-%M-%S [#prio]"),
make_shared<LogSinkCout>(debugSwitch.isSet()?(LogPriority::debug):(LogPriority::info), LogSink::Type::all, debugSwitch.isSet()?"%Y-%m-%d %H-%M-%S.#ms [#prio] (#tag)":"%Y-%m-%d %H-%M-%S [#prio]"),
make_shared<LogSinkNative>("snapserver", LogPriority::debug, LogSink::Type::special)
}
);