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
signature.asc
Description: Digital signature
