git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Logging all the requests into a specific file


On 28/02/20 9:29 AM, valon.januzaj98 at gmail.com wrote:
> I am new to python and all of this, I am  using this FastAPI, to build API,
> I want when users hit any endpoint for ex /products, that to be written into a file , how do I do it?

The Python Standard Library offers a Logging library.
It has "handlers" to decide where each message to go, "filters" to 
determine 'levels' of messages, and "formatters" to organise the output.

-- 
Regards =dn