This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 3/4] Don't write LOG_BABBLE output to stdout
- From: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- To: cygwin-apps at cygwin dot com
- Cc: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- Date: Mon, 2 Mar 2015 13:55:24 +0000
- Subject: [PATCH setup 3/4] Don't write LOG_BABBLE output to stdout
- Authentication-results: sourceware.org; auth=none
- References: <1425304525-12268-1-git-send-email-jon dot turney at dronecode dot org dot uk>
It somewhat hampers the use of setup as a command line tool that it writes
everything to stdout. Don't write LOG_BABBLE output to stdout. Add '--verbose'
flag to restore the previous behaviour.
ChangeLog:
2015-03-02 Jon TURNEY <jon.turney@dronecode.org.uk>
* LogFile.cc (VerboseOutput): Add option.
(endEntry): Only write LOG_PLAIN to stdout, unless VerboseOutput.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
LogFile.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/LogFile.cc b/LogFile.cc
index dfb9622..b45d38c 100644
--- a/LogFile.cc
+++ b/LogFile.cc
@@ -36,6 +36,10 @@ static const char *cvsid =
#include "AntiVirus.h"
#include "filemanip.h"
#include "String++.h"
+#include "getopt++/BoolOption.h"
+
+static BoolOption VerboseOutput (false, 'v', "verbose",
+ "Verbose output");
using namespace std;
@@ -219,7 +223,9 @@ LogFile::endEntry()
string buf = theStream->str();
delete theStream;
- cout << buf << endl;
+ /* also write to stdout */
+ if ((currEnt->level >= LOG_PLAIN) || VerboseOutput)
+ cout << buf << endl;
if (!currEnt)
{
--
2.1.4