pip install logbook
1. StreamHandler
python
import logbook
logbook.StreamHandler().push_application()
log = logbook.Logger('Example')
log.warn('This is a warning message')
log.error('This is an error message')
2. FileHandler
python
import logbook
logbook.FileHandler('app.log', mode='a', level='DEBUG').push_application()
log = logbook.Logger('Example')
log.info('This is an info message')
log.debug('This is a debug message')
3. RotatingFileHandler
python
import logbook
logbook.RotatingFileHandler('app.log', max_size=1024, backup_count=5).push_application()
log = logbook.Logger('Example')
log.info('This is an info message')
log.debug('This is a debug message')