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 132 views
1 answer 101 views
101 views asked Feb 26, 2023 by avibootz
1 answer 166 views
166 views asked Apr 5, 2024 by avibootz
3 answers 213 views
213 views asked Apr 27, 2021 by avibootz
1 answer 218 views
...