Trace Capturing
How to capture errors in your code
Prerequisite Please see here to get and set your API Key environment variable.
Install the Lytix pip package
Make sure to set your API key e.g. export LX_API_KEY=...
Error Class
You can now just replace all your raise Exception
calls with raise LError
. For example:
The error, along with the last 20 log lines will automatically get pushed to the Lytix platform here
Error Increment
You can also send an error along with related logs without throwing an error by using the increment
method.
Fast API Integration
Lytix also supports capturing errors in FastAPI. To get started first hook up our Lytix middleware:
Now you can throw errors in your FastAPI routes or subcalls as follows:
Examples
To see all examples please check the Github repo here