python logging alternatives

Viewed 7268

The Python logging module is cumbersome to use. Is there a more elegant alternative? Integration with desktop notifications would be a plus.

4 Answers

Checkout logbook, it is much nicer to work with.

Logbook was mentioned in a comment but it deserves its own answer.

You might want to have a look at pysimplelog. It's pure python, very simple to use, pip installable and provides what you need

from pysimplelog import Logger
L=Logger()
print L
>>> Logger (Version 0.2.1)
>>> log type  |log name  |level     |std flag  |file flag |
>>> ----------|----------|----------|----------|----------|
>>> debug     |DEBUG     |0.0       |True      |True      |
>>> info      |INFO      |10.0      |True      |True      |
>>> warn      |WARNING   |20.0      |True      |True      |
>>> error     |ERROR     |30.0      |True      |True      |
>>> critical  |CRITICAL  |100.0     |True      |True      |

L.info('I am an info')
>>> 2016-09-26 15:01:17 - logger <INFO> I am an info

L.warn('I am a warning')
>>> 2016-09-26 15:01:17 - logger <WARNING> I am a warning

L.error('I am an error')
>>> 2016-09-26 15:01:17 - logger <ERROR> I am an error

and with those parameters, a 'simplelog.log' file will be created and updated automatically for you

Related