The logging
module has everything you could want. It may seem excessive at first, but only use the parts you need. I’d recommend using logging.basicConfig
to toggle the logging level to stderr
and the simple log methods, debug
, info
, warning
, error
and critical
.
import logging, sys
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
logging.debug('A debug message!')
logging.info('We processed %d records', len(processed_records))