Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python log with timestamp

import logging
logging.basicConfig(
        format='%(asctime)s %(levelname)-8s %(message)s',
        level=logging.INFO,
        datefmt='%Y-%m-%d %H:%M:%S')

logging.info('an info messge')
# 2017-05-25 00:58:28 INFO     an info messge
logging.debug('a debug messag is not shown')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #log #timestamp
ADD COMMENT
Topic
Name
9+4 =