Skip to main content

Quick and easy logging parameters for click commands.

Project description

Quick and easy logging parameters for click commands.

1 Installation

The click_logging_config package is available from PyPI. Installing into a virtual environment is recommended.

python3 -m venv .venv; .venv/bin/pip install click_logging_config

2 Getting Started

Using click_logging_config is intended to be very simple. A single decorator applied to your click command or group adds some click options specifically for managing logging context.

import click
import logging
from click_logging import logging_parameters

log = logging.getLogger(__name__)

def do_something()

@click.command()
# NOTE: Empty braces required for hard-coded click_logging.parameters defaults.
@click.option("--my-option", type=str)
@logging_parameters()
def my_command(my_option: str) -> None:
    log.info("doing something")
    try:
        do_something(my_option)
    except Exception as e:
        log.critical(f"something bad happened, {str(e)}")
        raise

Application of @logging_parameters decorator must be applied immediately above your click command function and below any other click decorators such as arguments and options.

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

click_logging_config-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

click_logging_config-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click_logging_config-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.15

File hashes

Hashes for click_logging_config-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f705364135639a627a67bdb28982a06f094d0c7d9cabcc18eb4332ca167a8338
MD5 49c02b2c55a44d8268431f9af1efe9a9
BLAKE2b-256 079ee66d9e12104e8ce9dd657e0c6b0a0d5eac0d3d15ea0bbf584bdfc2f0685d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for click_logging_config-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6826e315f7379b5537c521980456b6a14d10634ad880b3a75bbb5e532d01c897
MD5 e56ae2e258d8c86301a0c9a654957424
BLAKE2b-256 faf33d3d32665dfda329fc53188519f865540fc7183a4f8a8646cd26d629d9a5

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