python log with timestamp

Solutions on MaxInterview for python log with timestamp by the best coders in the world

showing results for - "python log with timestamp"
Axel
23 Aug 2020
1import logging
2logging.basicConfig(
3        format='%(asctime)s %(levelname)-8s %(message)s',
4        level=logging.INFO,
5        datefmt='%Y-%m-%d %H:%M:%S')
6
7logging.info('an info messge')
8# 2017-05-25 00:58:28 INFO     an info messge
9logging.debug('a debug messag is not shown')