From the course: Advanced Python: Working With Data
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Custom logging - Python Tutorial
From the course: Advanced Python: Working With Data
Custom logging
- [Instructor] The Python logging module is very flexible, and it makes it easy to customize the message output depending on your needs and this way, you're not stuck with a single message format. So the basic config function takes two arguments. There's format and there's date format. The format argument specifies a string that controls the precise formatting of the output message that is sent to the log, and the date format argument is used in conjunction with the format argument. So if the format argument contains a date specifier, then the date format argument is used to format the date string using the same kind of date formatting strings that you would pass to say the strftime function. The table that I'm showing you here, lists some of the formatting tokens you can use in the format argument. Now, this is not an exhaustive list, okay? But I've included the most common ones that you're likely to use, and they're…