Skip to main content

simple logs config

Project description

bxlogs

bxlogs is a minimal Python module for a basic logging setup. It exposes a single function, get_logger, which acts as a wrapper around logging.getLogger to set a default output on stderr with a sensible format. That’s all.

Install

With pip:

pip install bxlogs

With poetry:

poetry add bxlogs

Usage

from bxlogs import get_logger

logger = get_logger("my.module")
logger.info("all set!")

The default level is INFO.

You can set the level to DEBUG using various means:

  • debug=True
  • level="DEBUG" or level=logging.DEBUG
  • Set the environment variable BX_DEBUG
from bxlogs import get_logger

# All the calls below are equivalent

logger = get_logger("my.module", debug=True)
logger = get_logger("my.module", level="DEBUG")

import logging
logger = get_logger("my.module", level=logging.DEBUG)

import os
os.environ["BX_DEBUG"] = "1"
logger = get_logger("my.module")

You can set any other level using level=.

There’s nothing more. If you need anything more complex than that, use the Python logging module directly.

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

bxlogs-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

bxlogs-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file bxlogs-0.1.0.tar.gz.

File metadata

  • Download URL: bxlogs-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.7 Linux/5.15.0-1040-azure

File hashes

Hashes for bxlogs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4832c0de37207f5772cf090a3868cced687ad8aac6eb8812a0310affefbf26a
MD5 962310c3a849f3da56456fe3debf54b2
BLAKE2b-256 9f8d5acd69f5b843a66d10c03a90b2a24cd8acec8b3bea044e3fb472303a919f

See more details on using hashes here.

File details

Details for the file bxlogs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bxlogs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.7 Linux/5.15.0-1040-azure

File hashes

Hashes for bxlogs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa33bb8a8100210d210b03317b29ec3748232f6f628953d558436d21587df0e
MD5 05e3622e17d6713d2f56e8db3bc943ee
BLAKE2b-256 c475ba8fc677f922611f8edd5125295eca7fd27d3b1f847bc2f29794b9f993c7

See more details on using hashes here.

Supported by

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