Skip to main content

Made Tech R&D Logger

Project description

Rnd Logger

A python logger implementation for the Made Tech R&D department

This implementation adds flexibility for in and out of office hours alerts and inherits from the root logger provided by the python logging module. There are two log handlers available, the standard root logger and a json logger

Testing

  • run make test

Creating a release

  • Commit your changes to main and then create a release on Github.
  • This will trigger a Github action that will increment the version with the tag you have chosen and publish that version to PyPi
  • Please use semantic versioning and version relative to the change you have made

Usage

  1. Use the rnd_logger: 2. Root Logger: python from rnd_logger import rnd_logger logger = rnd_logger.get_logger() logger.debug("Debug message") logger.info("Info message") logger.warning("Warning message") logger.error_office_hours_alert("Office hours alert message") logger.error_out_of_hours_alert("Out of office hours alert message") 2. Json Logger: python from rnd_logger import rnd_logger logger = rnd_logger.get_logger("json") logger.debug("Debug message", extra={"json_key": "json_value"}) logger.info("Info message", extra={"json_key": "json_value"}) logger.warning("Warning message", extra={"json_key": "json_value"}) logger.error_office_hours_alert("Office hours alert message", extra={"json_key": "json_value"}) logger.error_out_of_hours_alert("Out of office hours alert message", extra={"json_key": "json_value"})
  2. Testing the rnd_logger: 3. There is a caplog fixture provided by pytest 4. python import logging def test_use_case_logs_info(caplog, use_case_under_test): with caplog.at_level(logging.INFO): your_test_code() records = iter(caplog.records) record = next(records) assert record.message == "your test log"

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

rnd_logger-1.4.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

rnd_logger-1.4.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file rnd_logger-1.4.1.tar.gz.

File metadata

  • Download URL: rnd_logger-1.4.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for rnd_logger-1.4.1.tar.gz
Algorithm Hash digest
SHA256 00b7a54ee06a61bbb588f3e47028a695339ad352f9792e46283883d2fc0aac81
MD5 756786e38f8574248a91a2c7b7f88196
BLAKE2b-256 569599894a763e0eabc76cf9d11ad6de8fab9f70ee166b96a8ff47b96c76c2c0

See more details on using hashes here.

File details

Details for the file rnd_logger-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: rnd_logger-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for rnd_logger-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7a35a59028b817a61979dc5c12b846e28d10765395f1140c88a6bec6643541f
MD5 3caaa0d7af54ef9933cbb82137b8074b
BLAKE2b-256 ddc4225c3ec15c27b58613e446be04130f7d62dbc491bde8228cd6ceefd8f61e

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