Skip to main content

minlog

a neat and simple minimalistic logging library for python.

installation

pip install minlog

usage

from minlog import Logger

# create a logger instance
my_logger = Logger()

# or use the global logger instance
from minlog import logger
my_logger = logger.logger_for("stuff")

# log messages with different severity levels
logger.debug("debugging info")
logger.trace("trace message")
logger.info("general information")
logger.warn("warning message")
logger.error("error condition")
logger.crit("critical failure")

controlling verbosity

# show only errors and critical messages
logger.be_quiet()

# show all messages including debug and trace
logger.be_verbose()

# show messages at debug level
logger.be_debug()

# temporarily change verbosity using context manager
with logger.verbosity(Verbosity.DEBUG):
    logger.debug("this will be shown")
    logger.trace("this too")

# conditional logging based on verbosity
if logger.is_verbosity_above(Verbosity.ERROR):
    logger.error("this will only show in verbose modes")

source logging

organize logs by source/context:

# create loggers for different components
app_logger = logger.logger_for("app")
db_logger = logger.logger_for("db")

app_logger.info("message from application")
db_logger.warn("database warning")

# temporary subsource context
with logger.subsource("api"):
    logger.info("message with api context")

class decoration

automatically add logging to classes:

from minlog import logged

@logged  # uses class name as source
class MyClass:
    def do_something(self):
        self.logger.info("doing something")

@logged("custom_source")  # specify custom source
class MyOtherClass:
    def do_something(self):
        self.logger.info("doing something else")

advanced features

# force a message regardless of verbosity
logger.force_log("important message")

# conditional logging based on verbosity threshold
logger.log_only_when_quieter_than("debug info", Verbosity.DEBUG)

# multi-line messages are supported
logger.info("line one\nline two")

# rich text formatting characters are handled correctly
logger.info("message with [brackets]")
logger.info("message with [red]color[/red]")

Metadata

Release files for minlog 0.6.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 minlog 0.6.0
File Size Uploaded Provenance
minlog-0.6.0.tar.gz 4.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for minlog 0.6.0
File Interpreter ABI Platform
minlog-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / minlog-0.6.0.tar.gz

Download URL minlog-0.6.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4c8a956abb2d5e788d19b5d8810c40d991041bf2d241d0f5b7064199ced9bd2f
BLAKE2b-256 checksum
How to use checksums
03229290ba26e08ad7f4505ffc87aaf9cbb033c196075f51532349b6107e0fbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0

Release files / minlog-0.6.0-py3-none-any.whl

Download URL minlog-0.6.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40377c2291c8efab16de1f53960ecabbd909c0f4b52911f4912a95e30a7e1abb
BLAKE2b-256 checksum
How to use checksums
f09d814bea46ab8efbcd9044c85c0dc3bae975f5705ecff3b14d951ed0804913
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.2 Darwin/24.3.0

Security for minlog 0.6.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.

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