Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/machinecyc/logging_extension
https://github.com/machinecyc/logging_extension
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/machinecyc/logging_extension
- Owner: machineCYC
- Created: 2023-07-15T14:24:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-22T03:22:27.000Z (over 1 year ago)
- Last Synced: 2023-07-22T07:23:02.458Z (over 1 year ago)
- Language: Python
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# logging_extension
Develop the customer logging to support sending the log to the database through web API
- api folder is the code base for the api service
- cus_logging is the code base for the customer loggingOur target is doing the coustomer log when logging some information
In this case is show the log in the console and send the log to an api service at the same time
The python logging module has four main components
- Loggers: log collector
- Handlers: decide the distination of the log
- Formatters: format the log
- Filters: filter out some logbase on the definetion of the logging components, we can customize the handler, use the handler to send the request to api service
## setup the python env
- poetry install## run the code
- run the api service
- cd api/
- uvicorn main:app --reload
- run the logging example
- python example.py## Reference
- [Writing Custom Log Handlers In Python](https://dev.to/salemzii/writing-custom-log-handlers-in-python-58bi)
- [Python Logging Tutorial: How-To, Basic Examples & Best Practices](https://sematext.com/blog/python-logging/)