Skip to main content

A python logging library that writes to console, local file and datadog

Project description

logutil

A simple logging library that can replace builtin logging and other structural logging libaries. logutil writes logs to:

  • Console
  • Local file
  • Datadog

Basic Usage

from logutil import log

log.info("hello", a=1, b="foo")

By default, logs appear in:

  • Your console
  • Append to /tmp/app.log

Configuration

You can customize logutil by calling init_logger:

from logutil import init_logger

init_logger(
    # Turn console logging on/off
    console=True,  
    
    # Change file logging settings
    file={
        "enabled": True,
        "path": "/tmp/app.log"
    },
    
    # Enable Datadog logging
    datadog={
        "api_key": "your_api_key",
        "site": "US3",
        "service": "your_service_name",
        "tags": {"env": "dev"}
    }
)

Datadog Configuration

To use Datadog logging, you must provide:

  1. Your Datadog API key
  2. The Datadog site you use

Valid Datadog sites:

  • US1
  • US3
  • US5
  • EU1
  • US1-FED

You can find your site in the URL when you log in to the Datadog web portal.

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

bfg_logutil-0.1.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

bfg_logutil-0.1.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bfg_logutil-0.1.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.5

File hashes

Hashes for bfg_logutil-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b4dffc3f6346a614588f9e51e89b65030f9848cb7fba0912b9e3158e70e4e179
MD5 92a328f175914cde9e494a3d0780b85f
BLAKE2b-256 7d2e5d26a9442bc11733aeeb7aba160b21837a263efd3d3e765d07fdb828c2b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bfg_logutil-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2dae0c389e3bfddf3bcbca2413e2ad9e4ffacb61e4dbbcd29964845ced5b8505
MD5 bfac29e09b457c49c07236820d96e7fd
BLAKE2b-256 679c66337fbf610c7aa75a24e7813eab95a9d6f30f11dab6d429bf96ac63b397

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