Skip to main content

Tiny library to push logs to `Grafana Loki` in `logfmt` format.

Project description

smoloki

PyPI version

Tiny library to push logs to Grafana Loki in logfmt format.

import smoloki


async def as_request_completed():
    await smoloki.push(
        {'service': 'web'},
        {'level': 'info', 'event': 'request_completed'},
    )


def as_request_completed():
    smoloki.push_sync(
        {'service': 'web'},
        {'level': 'info', 'event': 'request_completed'},
    )

Implementation details

  • Calls to push method will never throw. Any exception will just be logged using logging.
  • Keys in labels and information must be strings.
  • Values in labels and information must be string, integers or floats.
  • If no base_endpoint provided (using parameter or env), nothing will happen.

Configuration

  • SMOLOKI_BASE_ENDPOINT – base address of Loki server.
  • SMOLOKI_BASE_LABELS - base labels that will be added to logs.
  • SMOLOKI_BASE_INFORMATION - base information that will be added to logs.

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

smoloki-0.0.4.tar.gz (3.1 kB view details)

Uploaded Source

Built Distributions

smoloki-0.0.4-py3.10.egg (5.3 kB view details)

Uploaded Source

smoloki-0.0.4-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file smoloki-0.0.4.tar.gz.

File metadata

  • Download URL: smoloki-0.0.4.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for smoloki-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6dec1592d9d3b06e73d8f78c8066cccc683666b5f4a621dca82788c3392d3ae4
MD5 a6e2aa793373907e00fcf8b9eb630a62
BLAKE2b-256 2a586bd18e223a74ab94aa1d2fac6fa7ed831df3640bbca9b09ac0042b363f0a

See more details on using hashes here.

File details

Details for the file smoloki-0.0.4-py3.10.egg.

File metadata

  • Download URL: smoloki-0.0.4-py3.10.egg
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for smoloki-0.0.4-py3.10.egg
Algorithm Hash digest
SHA256 527beb4814b1a92c345f3aafff367100ab5fa26b7b55161c5f334b2664258511
MD5 3b59103a8b8af5f6244ccf1da32e2f59
BLAKE2b-256 ac53291832480006383908516c4aea541b9c8b0309f328791992917ac4ba785b

See more details on using hashes here.

File details

Details for the file smoloki-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: smoloki-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for smoloki-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5941df5d743a136feb09c03ce102a100796e6cadc3e1c98178bd41ccc5d2abf9
MD5 a3febd6760973a9570fa905a07f2381e
BLAKE2b-256 b23753e08172350a82be67804e29f47dc63dcdac893c3b0edcb9561a1a3b32da

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