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
- 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"})
- 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
Release history Release notifications | RSS feed
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.3.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file rnd_logger-1.4.3.tar.gz
.
File metadata
- Download URL: rnd_logger-1.4.3.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5793e6bde25419508bb91554dac502c6c38788d435dc12d83f108b47a7df8eb |
|
MD5 | 66775443a1def602715f3ce85c8b75a1 |
|
BLAKE2b-256 | 69ef0fd107f38806bf17e50175040f73fb1c54938ff393208d7b7b577b683d7b |
File details
Details for the file rnd_logger-1.4.3-py3-none-any.whl
.
File metadata
- Download URL: rnd_logger-1.4.3-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf8acad68be7b165c5d600ad7eb5026cdf54f5feb64a38cd8b04f07baeb3662 |
|
MD5 | 85beeb10476dd137b394002fbb306262 |
|
BLAKE2b-256 | ce306167e240249a58c45ad69dd5dd9819e4326ffa8cf2f9a6cb3b2f8a395c10 |