How to use time in logging message with Python

1 Answer

0 votes
import logging

logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG)
logging.info('info text')
logging.warning('warning text')

 
'''
run:
  
2018-06-25 08:07:07,195 info text
2018-06-25 08:07:07,195 warning text

'''

 



answered Jun 25, 2018 by avibootz

Related questions

1 answer 137 views
1 answer 105 views
105 views asked Feb 26, 2023 by avibootz
1 answer 170 views
170 views asked Apr 5, 2024 by avibootz
3 answers 217 views
217 views asked Apr 27, 2021 by avibootz
1 answer 221 views
...