Skip to main content

Typed loki handler for logging

Project description

sb-loki-handler

Typed loki handler for logging

Installation

You can install the package via pip:

pip install sb-loki-handler

Usage

import logging

from sb_loki_handler import LokiHandler

logger = logging.getLogger("my-logger")
logger.setLevel(logging.INFO)

handler = LokiHandler(
    "https://user:pass@host/loki/api/v1/push",
    labels={"application": "my-app"}
)
logger.addHandler(handler)


logger.info("Hello world.")
logger.info("With extra", extra={"labels": {"foo": "bar"}})

with handler.labels({"foo": "bar"}):
    logger.info("With context")

License

This project is licensed under the terms of the MIT license.

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

sb_loki_handler-1.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

sb_loki_handler-1.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file sb_loki_handler-1.0.0.tar.gz.

File metadata

  • Download URL: sb_loki_handler-1.0.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for sb_loki_handler-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9ec7248dd1f5737fa44373611de822572edcd32c2d28a27d6b3bd34eaf8fb51e
MD5 26c00ea0fb442b1fcf8d84f000cc045a
BLAKE2b-256 bec41aa9607030a9e22bcdcc08b1a6d9424d344499dd3368524b0161310d47fc

See more details on using hashes here.

File details

Details for the file sb_loki_handler-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sb_loki_handler-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d83d79ed3c16f013df666c800c72b1f4e3ae2678865c5c0a42a4378dd017f7c
MD5 ccf93df1df61bccc3b42168b51fce6ee
BLAKE2b-256 2a264cb26eb1b53cfcece2b5f651816c28200ddf6a7f7f6664a72030f7cb25cb

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