Mergifyio / daiquiri

Python library to easily setup basic logging functionality
Apache License 2.0
333 stars 25 forks source link

Make it easier to override the default formatting #27

Open lamby opened 6 years ago

lamby commented 6 years ago

Hey,

I really love how you can just do daiquiri.setup() and then just Move On. However, as soon as I would like to change the formatting (ie. drop the process ID and log name as it's always the same) then I end up having something relatively ugly:

formatter = daiquiri.formatter.ColorExtrasFormatter(
   fmt="%(color)s%(levelname).1s: %(message)s%(color_stop)s"
)

daiquiri.setup(outputs=(
    daiquiri.output.Stream(formatter=formatter),
))

Any ideas on making this rather common use-case a bit cleaner? (Perhaps a magic kwarg to daiquiri.setup() like fmt="..."?

jd commented 6 years ago

We could probably add a little helper module for common use cases like that.