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.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: rnd_logger-1.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f87a9d7daaf8841ea40ec988ce7ee8f2bd20113dbb8fcad71cb878faab75bfbc
MD5 b940ef16e0aad7ee09ce652bab57db9d
BLAKE2b-256 cc57bb52d05eb3dadb94d08ca42ead8b4f85cfda71be7cc7eb5b8f2a4ce399dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rnd_logger-1.4.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34499f9ceb51140e668dc72c036169fc2359d76e0c6a6db473bd3e874c3cfc18
MD5 e09c7820108a876a95435eb4f0318a60
BLAKE2b-256 ad43b876dfa5bdfe33c21a08e4683be84261b732c7f7d055d534324db3b7d3c0

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