Skip to main content

Python handler to logging services

Project description

Handlr | Without the 'e'

Created by Joe Tilsed | Created 11/10/2022 | Last Updated: 11/10/2022 | Current Version: 0.1.0

Handlr is a Python handler to logging services, i.e. Logstash as part of the ELK stack.

How to install

Simply run: pip install handlr.

How to use

An example would be to use this package for a logstash as part of the ELK stack.

import logging

from handlr import Handler

LOGGER_ENDPOINT = 'localhost'
LOGGER_PORT = 5040
LOG_LEVEL = 'DEBUG'
LOG_LABEL = 'VM_123ABC'
LOG_TAGS = ['virtual-machine', 'workers', 'EMEA']

log = logging.getLogger(__name__)
handler = Handler(LOGGER_ENDPOINT, LOGGER_PORT, LOG_LABEL, LOG_TAGS)
log.addHandler(handler)

# If you don't want the logs being shown to the console (aka only shown on ELK stack) then remove the below line.
log.addHandler(logging.StreamHandler())

log.setLevel(LOG_LEVEL)
log.info(f"Setup log, log level {LOG_LEVEL}. Sending logs to {LOGGER_ENDPOINT}:{LOGGER_PORT}.")

Enjoy!


# That's all folks...

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

handlr-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for handlr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f85c5961d00108a24096ca372349dc5e1cb70cc3b3ab6c622a4229174e75f20
MD5 e6a763bc7d6a02b542c51cc142599e71
BLAKE2b-256 b81e58abcee4707b6d1e4d0f63772f845d18ab4daaf88b51673f7a5156e395a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: handlr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for handlr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e28e29ac13f014d2572dc6a0c5d1ee5cea5c0643447ec641ffcebd5c93ffeab
MD5 6c1c6521b9355223fa13e1c88f7004b0
BLAKE2b-256 785d21de4f221c191ca0e7bc392aafe333916c1e4ec301432b511fe75e5e2784

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