From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 91D9F13888F for ; Fri, 9 Oct 2015 16:01:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5A6F9E07D1; Fri, 9 Oct 2015 16:01:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EEF0AE07D1 for ; Fri, 9 Oct 2015 16:01:34 +0000 (UTC) Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with SMTP id DF8123406C2 for ; Fri, 9 Oct 2015 16:01:33 +0000 (UTC) Date: Fri, 9 Oct 2015 12:01:32 -0400 From: Mike Frysinger To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] standardizing output Message-ID: <20151009160132.GA4625@vapier.lan> Mail-Followup-To: gentoo-catalyst@lists.gentoo.org References: <20151009003825.GD29146@vapier.lan> <20151008182415.10851222.dolsen@gentoo.org> <20151009060410.GE29146@vapier.lan> <20151009082631.4f841bf9.dolsen@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: <20151009082631.4f841bf9.dolsen@gentoo.org> X-Archives-Salt: 00457975-e74f-4675-b25e-080a8d320bbd X-Archives-Hash: 6b8419afc28d94917c96dbf3cfc9e097 --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 09 Oct 2015 08:26, Brian Dolbec wrote: > On Fri, 9 Oct 2015 02:04:10 -0400 Mike Frysinger wrote: > > i have noticed that DeComp calls print() and that's bad juju -- > > modules should never call print(). > >=20 > > if you do want to expose details like that in a module, you should use > > the logging module and tie it to a specific logger. something like: > > logger =3D logging.getLogger('DeComp') > > logger.setLevel(logging.CRITICAL) > > and then DeComp would only ever call logger.xxx to log output. > >=20 > > if people want to get logging details from DeComp, then they'd do: > > import DeComp > > DeComp.logger.setLevel(logging.DEBUG) > > assuming you put the logger into __init__.py of course. i have no > > opinion on how you want to structure that logic. >=20 > Yeah, I had every intention for it to use logging, I just needed > catalyst to get to using it. So catalyst would provide a logger for > it. I didn't have any intention for DeComp to create it's own. I's > just a small module that will live in other apps. if you call any logging function, you're picking a logger. even if you just call logging.log(...), you're implicitly picking the root logger. the advantage of DeComp creating its own logger is that people don't have to filter out messages from it. so while we might want catalyst to run in verbose mode, i don't think we want modules it pulls in like DeComp also cluttering up the output. if we did actually want messages =66rom DeComp, we can configure the logger it's using to have a higher level. -mike --wRRV7LY7NUeQGEoC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWF+TXAAoJEEFjO5/oN/WBN2IQAIY7Rcb39RlVCt1SQkqHq6Ru FNqBHYkCvrJZ9yN9XstUBB/J1o+MVwL6Logb8GUhOcsJYTlkEbG5+6mUOaNJNKtk nEgI0cForsXwq/LzirkJMX+rkfTWH6ITcGDIVMpo2tz2hqtMf2MmmZo81L7/pxdD oDYSFvpQGe1VIISPDjfqCUhDn8kGIl4kQh7dSbmlYpY/hnuspTSfG1VPHJYGM0gz 4gmbiOALIT8Kn8uG2hw5QeMF+WQgQRNNoGCjWbepmbax8l4oHb+i4yr8/WygejUW hdATXbslxMMBGeJoZxYDgpngyI94W2HjYVydgLb1ApKWmiPRThCPPdVjePc0G+nH XMT8AKcndSS4eTmzameE2otKWRpwiY6wdnxdbT7sOYFp2bgRGF/RFP2J+vfaPv4k R1vIE18tVn1XeSGrnJuDRuFHmzaamcjAqHCErgMBDbkaVab1j2CeymTKTRt7CAI3 jXaYfKtf1B+1kbUCfBg7FlvIg8JzC9f4i3ovjnivTJfQs9JyuYY47GHb/A4Dh/df M9kEG3UDe7k+XXemBIJ9OI04uGOoZh6Kb6HLsxQPMbGAKVFUnK6UdCS/zKBFi5gF qt4XF8xXsR8NRRUXCxymbYVvg8ptJL6OWrChFM1MGyZOoRPflV/wPJs82fLtD+BH jA2aYxfBF+STiEe27H0O =wvnf -----END PGP SIGNATURE----- --wRRV7LY7NUeQGEoC--