[PATCH setup 3/4] Don't write LOG_BABBLE output to stdout

Jon TURNEY jon.turney@dronecode.org.uk
Mon Mar 2 13:55:00 GMT 2015


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



More information about the Cygwin-apps mailing list