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 logging
Our 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 log
base on the definetion of the logging components, we can customize the handler, use the handler to send the request to api service
- poetry install
- run the api service
- cd api/
- uvicorn main:app --reload
- run the logging example
- python example.py