Skip to main content

stdlogpj

python logging done my way

home: https://github.com/prjemian/stdlogpj

INSTALL

pip install stdlogpj

USAGE:

import stdlogpj
logger = stdlogpj.standard_logging_setup("demo")
logger.info("hello")

DEMO:

#!/usr/bin/env python

import stdlogpj

logger = stdlogpj.standard_logging_setup("stdlogpj-demo")


def thing1(i):
    logger.info(f"something #{i+1}")


def main():
    logger.info("hello")
    for i in range(5):
        logger.debug("calling thing1()")
        thing1(i)
    logger.critical("complete")


if __name__ == "__main__":
    logger.warning("before main()")
    main()
    logger.error("after main(): no error, really")

Rotate files and limit size

Using features of the RotatingFileHandler, it is possible to limit the size of the files by switching to a new log file, saving the old log file(s) by appending a number. Lower numbers are more recent.

Use this instead to limit logs to 1 MB and no more than 5 numbered (previous) log files:

logger = stdlogpj.standard_logging_setup("stdlogpj-demo", maxBytes=1024*1024, backupCount=5)

Metadata

Release files for stdlogpj 1.0.3

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

Source distribution (sdist)

Source distribution for stdlogpj 1.0.3
File Size Uploaded Provenance
stdlogpj-1.0.3.tar.gz 24.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for stdlogpj 1.0.3
File Interpreter ABI Platform
stdlogpj-1.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 33.3 kB

Release files / stdlogpj-1.0.3.tar.gz

Download URL stdlogpj-1.0.3.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
184e30c0710395019e6396732ae17acdf3eb2bd6aa4c1e9fb662b818b219ba19
BLAKE2b-256 checksum
How to use checksums
06ff52dcab6dc56a85a247c1d689366c6c612d27afcda44edbfdf60cad01823e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / stdlogpj-1.0.3-py2.py3-none-any.whl

Download URL stdlogpj-1.0.3-py2.py3-none-any.whl
Size 9.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ed694b7edf25a4623f12889c0c885e2f222eb0db543e38c9e718e84605e5dd8c
BLAKE2b-256 checksum
How to use checksums
7321055672d51de1d3cce48b5d003ce180cd66429e8b822016721d31f600de5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for stdlogpj 1.0.3

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.

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