Reusable CloudWatch log sender
Project description
logservice
An async Python module for sending structured JSON logs to AWS CloudWatch Logs from any Python application, including FastAPI, Flask, background workers, and CLI tools.
📦 Installation
Install directly from PyPI:
pip install logservice
🚀 Usage
from fastapi import FastAPI
from logservice import AsyncCloudWatchLogService, LogEntry
app = FastAPI()
log_service = AsyncCloudWatchLogService(
aws_access_key="...",
aws_secret_key="...",
region_name="us-east-1",
log_group_name="app-logs",
log_stream_name="login-events"
)
@app.post("/login")
async def login():
await log_service.log(LogEntry(
level="INFO",
message="User logged in",
service_name="LoginService",
extra={"user_id": 123}
))
return {"message": "Logged"}
🔧 Development & Deployment
Prerequisites
pip install twine build
Deployment Steps
- Update version in
setup.py - Clean old builds:
rm -rf dist/ build/ *.egg-info/
- Build package:
python setup.py sdist bdist_wheel
- Upload to PyPI:
python -m twine upload dist/*
Quick Deploy Script
# Clean, build, and deploy
rm -rf dist/ build/ *.egg-info/
python setup.py sdist bdist_wheel
twine upload dist/*
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
logservice-0.1.10.tar.gz
(3.2 kB
view details)
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 logservice-0.1.10.tar.gz.
File metadata
- Download URL: logservice-0.1.10.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df169ebf4bb598e2a3b9fdbb45dff24c24bd3beadd605b36c1c0d7617192bf54
|
|
| MD5 |
e938e86fc85e1ea96d723f336b2a7d59
|
|
| BLAKE2b-256 |
ab92fc9ad9e92e0b98b8669e5d92d5b2db423334427c3babbcc91443c4997c88
|
File details
Details for the file logservice-0.1.10-py3-none-any.whl.
File metadata
- Download URL: logservice-0.1.10-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37eaa6090255dffcedab9bfa776755b90046acdd6abac1c3d32dcdcfad8bb99c
|
|
| MD5 |
400d5aeec2aad8625d1bbb0deca79226
|
|
| BLAKE2b-256 |
0b0e96c1141984b1badf7758bc616be799ef51c31407595d71e381905eaf231f
|