Official Python SDK for LogNexis API Monitoring & Observability
Project description
LogNexis Python SDK
The official Python tracking SDK for LogNexis — the lightweight, real-time API monitoring, analytics, and observability platform.
Website: https://lognexis.online
Documentation: https://lognexis.online/docs
What it does
Automatically capture API request logs, HTTP errors, latency metrics, and real-world performance without blocking your application threads. Includes drop-in middlewares for FastAPI and Flask!
Installation
pip install lognexis-py
Quick Start (FastAPI)
from fastapi import FastAPI
from lognexis import LogNexisFastAPI
app = FastAPI()
# Add the LogNexis middleware
app.add_middleware(LogNexisFastAPI, api_key="YOUR_LOGNEXIS_API_KEY")
@app.get("/")
def read_root():
return {"Hello": "World"}
Quick Start (Flask)
from flask import Flask
from lognexis import LogNexisFlask
app = Flask(__name__)
# Add the LogNexis tracking hook
LogNexisFlask(app, api_key="YOUR_LOGNEXIS_API_KEY")
@app.route("/")
def hello():
return "Hello World!"
Quick Start (Django)
- Add your API key to
settings.py:
LOGNEXIS_API_KEY = "YOUR_LOGNEXIS_API_KEY"
- Add the middleware to
MIDDLEWAREinsettings.py:
MIDDLEWARE = [
# ... other middleware ...
'lognexis.LogNexisDjango',
]
Quick Start (Streamlit)
Since Streamlit is not a traditional web server, you can use the base client to manually log user interactions or pipeline executions:
import streamlit as st
from lognexis import LogNexisClient
client = LogNexisClient(api_key="YOUR_LOGNEXIS_API_KEY")
st.title("My GenAI App")
if st.button("Run Model"):
# ... do work ...
client.send_log({
"method": "POST",
"endpoint": "/run-model",
"statusCode": 200,
"latency": 450.5
})
st.success("Model executed!")
Manual Usage
If you aren't using FastAPI/Flask or want to log background jobs:
from lognexis.client import LogNexisClient
client = LogNexisClient("YOUR_LOGNEXIS_API_KEY")
client.send_log({
"endpoint": "/custom-cron-job",
"method": "POST",
"statusCode": 200,
"latency": 45.2
})
How it works
This SDK uses python's built-in threading and the lightweight requests library. It operates in a completely "fire-and-forget" background thread, meaning your application will NEVER crash and your API response times will NEVER be slowed down by this SDK.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lognexis_py-1.0.3.tar.gz.
File metadata
- Download URL: lognexis_py-1.0.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca183bd3c4e0543a1260920edf200d18ff940923f920aa0ba6672ec14542ef16
|
|
| MD5 |
ac7d6e61479f20fc08c8c9f54ebfe36e
|
|
| BLAKE2b-256 |
0604c173c03b8ff97df22ccc946ed0740d794bc580386ea6292a5839abc164c6
|
File details
Details for the file lognexis_py-1.0.3-py3-none-any.whl.
File metadata
- Download URL: lognexis_py-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
545774563f148c4b8b072c5f8fa71215e6ba4be1dd6d5b5ba10ecc3c4e2b2a70
|
|
| MD5 |
0f15f71ad59a20a7a6d5891811f1df4d
|
|
| BLAKE2b-256 |
a3a0fc0fdd2a7245dd036a20457bf4677b704b38be04970501b64fc4171a16f7
|