From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47269 invoked by alias); 2 Mar 2015 13:55:57 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 47218 invoked by uid 89); 2 Mar 2015 13:55:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: rgout06.bt.lon5.cpcloud.co.uk Received: from rgout06.bt.lon5.cpcloud.co.uk (HELO rgout06.bt.lon5.cpcloud.co.uk) (65.20.0.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Mar 2015 13:55:55 +0000 X-OWM-Source-IP: 31.51.205.191(GB) X-OWM-Env-Sender: jonturney@btinternet.com X-CTCH-RefID: str=0001.0A090205.54F46BEB.0038,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-Junkmail-Premium-Raw: score=27/50,refid=2.7.2:2015.2.26.105422:17:27.888,ip=31.51.205.191,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __REFERENCES, __ANY_URI, __URI_NO_WWW, __URI_NO_PATH, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1200_1299, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, __URI_NS, SXL_IP_DYNAMIC[191.205.51.31.fur], HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_2000_LESS, BODY_SIZE_7000_LESS, REFERENCES X-CTCH-Spam: Unknown Received: from localhost.localdomain (31.51.205.191) by rgout06.bt.lon5.cpcloud.co.uk (8.6.122.06) (authenticated as jonturney@btinternet.com) id 54EE0C8F00A9104B; Mon, 2 Mar 2015 13:55:55 +0000 From: Jon TURNEY To: cygwin-apps@cygwin.com Cc: Jon TURNEY Subject: [PATCH setup 3/4] Don't write LOG_BABBLE output to stdout Date: Mon, 02 Mar 2015 13:55:00 -0000 Message-Id: <1425304525-12268-4-git-send-email-jon.turney@dronecode.org.uk> In-Reply-To: <1425304525-12268-1-git-send-email-jon.turney@dronecode.org.uk> References: <1425304525-12268-1-git-send-email-jon.turney@dronecode.org.uk> X-SW-Source: 2015-03/txt/msg00010.txt.bz2 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 * LogFile.cc (VerboseOutput): Add option. (endEntry): Only write LOG_PLAIN to stdout, unless VerboseOutput. Signed-off-by: Jon TURNEY --- 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