From 72cb5a0e7e8b294b327f4a8ffbcce3951956fa67 Mon Sep 17 00:00:00 2001 From: badaix Date: Mon, 24 Jul 2017 21:18:39 +0200 Subject: [PATCH] add hidden debug log option --- client/snapClient.cpp | 4 +++- server/snapServer.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/snapClient.cpp b/client/snapClient.cpp index d9513088..3ce8b132 100644 --- a/client/snapClient.cpp +++ b/client/snapClient.cpp @@ -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 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(LogPriority::info, LogSink::Type::all), //, "%Y-%m-%d %H-%M-%S [#prio]"), + make_shared(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("snapclient", LogPriority::debug, LogSink::Type::special) } ); diff --git a/server/snapServer.cpp b/server/snapServer.cpp index 8cf927ab..0774731f 100644 --- a/server/snapServer.cpp +++ b/server/snapServer.cpp @@ -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 portValue("p", "port", "Server port", settings.port, &settings.port); Value 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(LogPriority::info, LogSink::Type::all), //, "%Y-%m-%d %H-%M-%S [#prio]"), + make_shared(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("snapserver", LogPriority::debug, LogSink::Type::special) } );