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.0.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file rnd_logger-1.4.0.tar.gz
.
File metadata
- Download URL: rnd_logger-1.4.0.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 | 6684e9dd9d5ffba699ef6c3268d1609523ecfc43a520a125dc30dd4da481fc57 |
|
MD5 | 7424e3454588575a4f743f3524af7cd4 |
|
BLAKE2b-256 | 14c19687e2db341ba8e66d95cf612a97470fbdc89d9338b6a48ba9594d84b0ac |
File details
Details for the file rnd_logger-1.4.0-py3-none-any.whl
.
File metadata
- Download URL: rnd_logger-1.4.0-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 | 49e945d14ab6e82ac11e829510722589cacee86b865506d3aa1320f28491bab6 |
|
MD5 | 9a313ff6bb34cf3600a5a866fdc6c431 |
|
BLAKE2b-256 | 981c4256885e65bcf465aebe0b3ecbf682265110bf7496c3114c62c05902342c |