public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Subject: Re: [gentoo-catalyst] standardizing output
Date: Fri, 9 Oct 2015 08:26:31 -0700	[thread overview]
Message-ID: <20151009082631.4f841bf9.dolsen@gentoo.org> (raw)
In-Reply-To: <20151009060410.GE29146@vapier.lan>

[-- Attachment #1: Type: text/plain, Size: 2503 bytes --]

On Fri, 9 Oct 2015 02:04:10 -0400
Mike Frysinger <vapier@gentoo.org> 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)
> > 
> > It's been on our wish list for several years.  So go for it!
> 
> done!
> 
> > That'll be one less thing holding up p3 compatibility.
> > 
> > I've added some extra print statements in there doing the re-write,
> > but there was just too much in there that needed fixing.
> 
> i have noticed that DeComp calls print() and that's bad juju --
> modules should never call print().
> 
> 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 = logging.getLogger('DeComp')
> 	logger.setLevel(logging.CRITICAL)
> and then DeComp would only ever call logger.xxx to log output.
> 
> 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.


-- 
Brian Dolbec <dolsen>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 951 bytes --]

  reply	other threads:[~2015-10-09 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09  0:38 [gentoo-catalyst] standardizing output Mike Frysinger
2015-10-09  1:24 ` Brian Dolbec
2015-10-09  6:04   ` Mike Frysinger
2015-10-09 15:26     ` Brian Dolbec [this message]
2015-10-09 16:01       ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151009082631.4f841bf9.dolsen@gentoo.org \
    --to=dolsen@gentoo.org \
    --cc=gentoo-catalyst@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox