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.3.tar.gz (3.2 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.3-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logservice-0.1.3.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

Hashes for logservice-0.1.3.tar.gz
Algorithm Hash digest
SHA256 00b08021e536b7277717615b05fe4fd4c0e3c531881719ecddc37eca69a7f470
MD5 a2c7f96ecceb940fe70fb1238e22557b
BLAKE2b-256 37db99419710e34ccb6619024f2b0224a1870ab0227303cb07eb2502d21299ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logservice-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ba4e7908760747185941df613ac0bd3757631586755c4bf1d6022080c9d93aa
MD5 6177b9462b6529a732e179996a20c762
BLAKE2b-256 88c49cda68635118c9392b810202628d6c181e042ddd040dd92bad9cf5dfb750

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