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:
from rnd_logger import rnd_logger
logger = rnd_logger.get_logger()
   
def your_test_code():
    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")
  1. Json Logger:
from rnd_logger import rnd_logger
logger = rnd_logger.get_logger("json")
   
def your_test_code():
    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"})
  1. Testing the rnd_logger: 3. There is a caplog fixture provided by pytest
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.5.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: rnd_logger-1.4.5.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for rnd_logger-1.4.5.tar.gz
Algorithm Hash digest
SHA256 b484f7ce7248a4e9c5a1e365f7fc0eba932f713be80e0b5b0e724c737ef794b1
MD5 0da2f716f9018e61c1ce3ff030a0f29e
BLAKE2b-256 8836f309e02c891980639abe8569ea5b362131fd941d82b4d131588283699103

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rnd_logger-1.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 736758d80daeab79afb7a117bff3db2db91257d9015a5c544b88f419e2c7ce56
MD5 179c265d1691e88454c6de79b7a5ba07
BLAKE2b-256 dc4c136d0b3e8ef9069ba42f5afeded34e58db589c9eff192b2405e662cc0602

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