wearpants / twiggy

Pythonic logger, shipped in Redhat & Debian
BSD 3-Clause "New" or "Revised" License
47 stars 11 forks source link

Work on Python 3 #49

Closed msabramo closed 9 years ago

msabramo commented 9 years ago

This brings over changes from https://github.com/wearpants/twiggy/pull/34, which targeted the master branch and applies them to the maint-0.4 branch.

In case it's easier to put out a new release from the maint-0.4 branch rather than the master branch (which you've said is in an indeterminate state) -- to make Python 3 work and fix #36.

Refs: #36

msabramo commented 9 years ago

Passing Travis CI build: https://travis-ci.org/wearpants/twiggy/builds/47264409

$ tox
...
  py26: commands succeeded
  py27: commands succeeded
  pypy: commands succeeded
  py33: commands succeeded
  py34: commands succeeded
  congratulations :)
# example.py

from twiggy import quickSetup, log

quickSetup()

log.name('frank') \
   .fields(number=42) \
   .info("hello {who}, it's a {0} day", 'sunny', who='world')
log.name('donjuan') \
   .fields(pants='sexy') \
   .info("hello, {who} want to {what}?", who='ladies', what='dance')
$ python3.4 example.py
INFO:frank:number=42:hello world, it's a sunny day
INFO:donjuan:pants=sexy:hello, ladies want to dance?