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 9B9C813888F for ; Fri, 9 Oct 2015 15:27:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5C00721C003; Fri, 9 Oct 2015 15:27:23 +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 BD45421C003 for ; Fri, 9 Oct 2015 15:27:22 +0000 (UTC) Received: from professor-x (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 7620C34070A for ; Fri, 9 Oct 2015 15:27:21 +0000 (UTC) Date: Fri, 9 Oct 2015 08:26:31 -0700 From: Brian Dolbec To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] standardizing output Message-ID: <20151009082631.4f841bf9.dolsen@gentoo.org> In-Reply-To: <20151009060410.GE29146@vapier.lan> References: <20151009003825.GD29146@vapier.lan> <20151008182415.10851222.dolsen@gentoo.org> <20151009060410.GE29146@vapier.lan> Organization: Gentoo 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-sha512; boundary="Sig_/=UOx/iQKGDu/lmUxTJcop2z"; protocol="application/pgp-signature" X-Archives-Salt: f7ab2975-3cdb-43f9-9352-04cecfeeeae8 X-Archives-Hash: b976ff2b33ed765f8405df684c7c3659 --Sig_/=UOx/iQKGDu/lmUxTJcop2z Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 9 Oct 2015 02:04:10 -0400 Mike Frysinger wrote: > On 08 Oct 2015 18:24, Brian Dolbec wrote: > > On Thu, 8 Oct 2015 20:38:25 -0400 Mike Frysinger wrote: > > > how do people feel about killing off the use of "print" > > > everywhere and moving to the standard logging module ? biggest > > > advantages in my mind: > > > - we get much easier control over where the output goes > > > (file/stdout/...) > > > - we force people to select a level (info/warning/error) > > > - we get standardized output > > > - we can more easily control the output (debug/verbose/etc...) > > > - we can include module/func/line info transparently in debug > > > modes > > > - we can exit transparently on fatal/critical messages (rather > > > than using die/exit/etc... directly) > > > - we can colorize warnings/errors transparently > > > - we get py3 compat for free (all current print usage is py2-only) > >=20 > > It's been on our wish list for several years. So go for it! >=20 > done! >=20 > > That'll be one less thing holding up p3 compatibility. > >=20 > > I've added some extra print statements in there doing the re-write, > > but there was just too much in there that needed fixing. >=20 > 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. > -mike 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. I've just made the API consumer apps provide a logging or similar suitable module. I'll convert it over tomorrow. I'm pleased it won't have it's first release using the print(). They were really just for debugging mostly. There are a few for errors. I'll have a look at the other patches in the morning. --=20 Brian Dolbec --Sig_/=UOx/iQKGDu/lmUxTJcop2z Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.1 iQJ8BAEBCgBmBQJWF9ynXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNUQ3Qzc0RTA4MUNDNzBEQjRBNEFBRjVG QkJEMDg3Mjc1ODIwRUQ4AAoJEPu9CHJ1gg7YKNoQAIWORUqwncyJX+SnZabJlebV rYfu65sMiOhM+cg2ubyq6oVkZFyQsg2etx75HKks/nfv/XaEdp7/Z7jW1ZIdW+2l RGfgrGlC5lq5+wRKufVTFVeOeXP+QgYPbka2S5NBW4ptQjhIHQIkk6Ir5ovimzSo 3Vwavl2qEZyqfflHp7fUhqKAisdCeUO+Tlf9Xk1gutOqDzZFLoU4TF7rZbv0J6/X 1HzdNTP/0nFvDUphJFZu2muFtyuozhuV84b3mB9NdG0tYcdpqJuvj01YaniAm0pz G2OjayD67XL7k2nteNuWv1MlIPaD8JorMtkBH5P9zo2H0/azwE5I/qJ+M9WJyqJe Q10K/BpzPA9DImoL/Hvl459YVieDEZWM/nfHiWEXc6yHo0kyW5lFywIRfy+i0UHF WKxlhFJiG9VVCzDIhs6opphjtAOlvCd18oVF9qvY6uaoe5IaXDvH9DK+Svck505l JOUrBpKcZV/WCO4qRcqXp9NEZ7SanwBtI0bZRoVhdUvLNJwoudWstAJZxJHkX/vh 1+gV6Frs9eTwSkZ2c38yH7jwegeQQhltHf/V5i/J9mtEu4dJKLO9ejkBjJxjLAeX Qy+EmcQ7K1oR0B7nq/ZERmoG/RND8BoQY2EBUa//6SsFmlBpw7XndUvBGLq2Z5Xi Z2b3UA8ETKeSzd9/Jijm =7HKg -----END PGP SIGNATURE----- --Sig_/=UOx/iQKGDu/lmUxTJcop2z--