appppple
appppple

Reputation: 71

Logging in custom time format

The logging module offers automatic display off information next to the logging message:

logging.basicConfig(format='%(levelname)s {%(filename)s:%(lineno)s} in %(funcName)s: %(message)s', level=logging.DEBUG)

I want to include the seconds from start of the runtime of the script. logging module offers msecs but how can i include the seconds since start inside this format string?

Upvotes: 1

Views: 127

Answers (1)

wim
wim

Reputation: 363435

In the documented logrecord attributes:

relativeCreated %(relativeCreated)d 

Time in milliseconds when the LogRecord was created, relative to 
the time the logging module was loaded.

Upvotes: 1

Related Questions