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.2.1.tar.gz (8.2 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.2.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bfg_logutil-0.2.1.tar.gz
Algorithm Hash digest
SHA256 65f0d3ebd5f82b434d0cf00984b73bb3720f390164b0e1072049bfca7a0eb2f2
MD5 840cd08e5b2062d0bee8c5ba2d0a1e10
BLAKE2b-256 3790cf2aa3b1e3162ff3a5cb1704abc3fb97eebd4fbff943efec438096522c36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bfg_logutil-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18d3cd4789fe57a35de735c742dfadc8907159c6957786424a27150689134ad5
MD5 0c9e47b314ab8095d9937616b5699b64
BLAKE2b-256 4b5fa47dfc96318a283afe7e455f4b8157229966fd140b744f5fc66c2d87f104

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