Skip to main content

logging_nice_handlers

GitHub last commit GitHub license<space><space> Documentation Status https://travis-ci.org/stas-prokopiev/logging_nice_handlers.svg?branch=master PyPI PyPI - Python Version

Overview.

This library consists of different logging handlers which I see usefull in different projects.

Installation via pip:

pip install char

logging Handlers

AllLevelFileHandler

This handler quite similar to logging.FileHandler but instead of FileHandler
it saves not in one file but in separate file for every level
So as the results in some directory you will get files
  • debug_msgs.txt - For all messages for levels logging.DEBUG and above

  • info_msgs.txt - For all messages for levels logging.INFO and above

  • warning_msgs.txt - For all messages for levels logging.WARNING and above

  • error_msgs.txt - For all messages for levels logging.ERROR and above

Such structure of logs can be quite usefull if your projected is expected to be used by externel users
So in case of some errors all these files with logs can be sent to the author and be analyzed.
import logging
from logging_nice_handlers import AllLevelFileHandler

LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(10)
LOGGER.addHandler(
    AllLevelFileHandler(
        str_path_dir_with_logs="Logs",
        str_open_mode="w",
    )
)
LOGGER.info("Hi friend!")

JupyterStreamHandler

This handler is the replacement for logging.StreamHandler when it should be used in jupyter notebooks
It will highlight in red all messages with the level which is above some set level.
So you won’t miss that the warnings or errors are happening in you programm.
import logging
from logging_nice_handlers import JupyterStreamHandler

LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(10)
LOGGER.addHandler(
    JupyterStreamHandler(
        int_min_stdout_level=logging.INFO,
        int_min_stderr_level=logging.WARNING,
    )
)
LOGGER.warning("Hi friend!")

Contacts

License

This project is licensed under the MIT License.

Metadata

Release files for logging-nice-handlers 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logging-nice-handlers 0.1.0
File Size Uploaded Provenance
logging_nice_handlers-0.1.0.tar.gz 16.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for logging-nice-handlers 0.1.0
File Interpreter ABI Platform
logging_nice_handlers-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 23.3 kB

Release files / logging_nice_handlers-0.1.0.tar.gz

Download URL logging_nice_handlers-0.1.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2648954fa4b3798909221759ecbd0b295c9807f17148f7c7e465fd35f2a7f1c9
BLAKE2b-256 checksum
How to use checksums
30139f159342566b338deca46a88a752e1b51ca2bf7e0dcad31dd195a9ee2918
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Release files / logging_nice_handlers-0.1.0-py2.py3-none-any.whl

Download URL logging_nice_handlers-0.1.0-py2.py3-none-any.whl
Size 6.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9e77dd571486f1f5f26b112506cceeba58adece9adb964a590c19cee71fb8558
BLAKE2b-256 checksum
How to use checksums
9c0bf39fc5f0f57466a72ce0fb8f94bf873150d45c8d0797dfff307d48c7911f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Security for logging-nice-handlers 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page