Skip to main content

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

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"}

Project details


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.7.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logservice-0.1.7-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file logservice-0.1.7.tar.gz.

File metadata

  • Download URL: logservice-0.1.7.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for logservice-0.1.7.tar.gz
Algorithm Hash digest
SHA256 dd8b2d1a293248942806c755942a0ea996e61405c453798181e34068b61a23b7
MD5 ab0ffb7133bc2d0c4493783b471da2eb
BLAKE2b-256 7050a8ff105d6e27cf7303c4eae09475b715675af2d8f1b6e95e87aafce0bfe5

See more details on using hashes here.

File details

Details for the file logservice-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: logservice-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for logservice-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 aed57d9cb60eb4bc45f1b5f91495eace7b62c38488c8abcd74f4e0861d3b2381
MD5 4882ba0d7c4dd02dfb9c8f83b8f16a97
BLAKE2b-256 1d517957c73158dfc4309b6b8ed7e59ecc89e2e33bac26e9dd07a835e3ed2134

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page