https://github.com/ThomasJay/PythonProLogging
Python Logging example with multiple outputs (File and stdout) with configuration for date/time, message, line number and file name
https://github.com/ThomasJay/PythonProLogging
Last synced: 4 months ago
JSON representation
Python Logging example with multiple outputs (File and stdout) with configuration for date/time, message, line number and file name
- Host: GitHub
- URL: https://github.com/ThomasJay/PythonProLogging
- Owner: ThomasJay
- Created: 2024-02-13T00:32:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-13T00:55:09.000Z (about 1 year ago)
- Last Synced: 2024-08-14T07:08:01.391Z (8 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - ThomasJay/PythonProLogging - Python Logging example with multiple outputs (File and stdout) with configuration for date/time, message, line number and file name (Python)
README
# PythonProLogging
Python Logging example with multiple outputs (File and stdout) with configuration for date/time, message, line number and file name
## logging config
```
logger.basicConfig(
format="%(asctime)s %(levelname)s %(message)s (Line: %(lineno)d [%(filename)s])",
level=logger.INFO,
handlers=[
logger.FileHandler("myapp.log"),
logger.StreamHandler(sys.stdout),
],
)
```Medium Article
https://medium.com/@thomasjay200/python-pro-logging-for-java-devs-90b18031e268