Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Higher precision logging module time format? [duplicate]

Tags:

python

I am using the logging module from Python and I need to get information about the starting and ending time of different functions calls. For this, I am currently using

formatter = logging.Formatter('%(message)s %(asctime)s.%(msecs)03d %(levelname)s',
                              datefmt='%H:%M:%S')

Since the calls of a particular function do not last more than a few milliseconds, I would like to get a better precision and have more decimal digits. How can I do this?

I nice solution at: Python logging: use milliseconds in time format

like image 594
wrong_path Avatar asked Oct 07 '26 21:10

wrong_path


1 Answers

I will update this answer because the solution wasn't good. A good answer can be found here Python Logging Module logging timestamp to include microsecond

like image 67
A Monad is a Monoid Avatar answered Oct 09 '26 10:10

A Monad is a Monoid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!