Skip to main content

Fewsats Logger

A simple Python logging wrapper for Better Stack (Logtail) with automatic environment context.

5-Minute Setup

  1. Install package

    pip install fewsats-logger
    
  2. Set environment variables (in .env file or environment)

    BETTER_STACK_SOURCE_TOKEN=your_source_token
    BETTER_STACK_HOST=your_source_host
    ENV=dev
    

IMPORTANT: Use dev and prod for ENV values.

Get the host & token by creating a new source at https://telemetry.betterstack.com/

  1. Initialize once in your main file

     from fewsats_logger.core import setup_logging
    setup_logging()
    
  2. Use standard logging anywhere in your code

    import logging
    logger = logging.getLogger(__name__)
    logger.info("Message")
    logger.error("Error", extra={"order_id": "12345"})  # Add filterable fields
    

That's it. Logs will appear in Better Stack dashboard and console.


Additional Details

Log Levels

  • logger.debug(): Detailed debugging information
  • logger.info(): Confirmation that things are working
  • logger.warning(): Something unexpected happened
  • logger.error(): A more serious problem
  • logger.critical(): A fatal error that prevents operation

Adding Context for Filtering

logger.info("Processing order", extra={
    "order_id": "12345",
    "customer_id": "67890"
})

Integration Examples

FastAPI

from fastapi import FastAPI
from fewsats_logger import setup_logging

setup_logging()
app = FastAPI()

Flask

from flask import Flask
from fewsats_logger import setup_logging

setup_logging()
app = Flask(__name__)

Command Line

from fewsats_logger import setup_logging
import logging

def main():
    setup_logging()
    logger = logging.getLogger(__name__)
    logger.info("Starting application")

if __name__ == "__main__":
    main()

Metadata

Release files for fewsats-logger 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fewsats-logger 0.0.3
File Size Uploaded Provenance
fewsats_logger-0.0.3.tar.gz 8.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fewsats-logger 0.0.3
File Interpreter ABI Platform
fewsats_logger-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / fewsats_logger-0.0.3.tar.gz

Download URL fewsats_logger-0.0.3.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
703e72e568c0cc01ee19bc2888daf49fa5abd63605bd8f2053bccf54f47b775b
BLAKE2b-256 checksum
How to use checksums
e3450ef8243940e700f8326ff33d3f8cf73a7be32eb6b41755075fa610433870
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / fewsats_logger-0.0.3-py3-none-any.whl

Download URL fewsats_logger-0.0.3-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d4453ed9e6e965b6b10f386955f816e25b93922fc200184b6eae8541dfd3148
BLAKE2b-256 checksum
How to use checksums
fe2bd5dc696832c99f8d7832f3209aaf564e04081abc825fe10089f67bcf27c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Security for fewsats-logger 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page