Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rnd-logger

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rnd-logger

Made Tech R&D Logger

  • 1.4.5
  • PyPI
  • Socket score

Maintainers
1

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"

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc