Simple Log Factory – a lightweight wrapper around Python's logging module.
Project description
Simple Log Factory
A lightweight wrapper around Python's built-in logging module that creates
pre-configured loggers with sensible defaults.
Requires Python 3.9+
Installation
pip install simple_log_factory
Usage
Basic console logger (DEBUG level)
from simple_log_factory import log_factory
logger = log_factory("my_app")
logger.info("Application started")
Console + rotating file logger
The file log rotates daily at midnight. The time-only format (%H:%M:%S) is
used automatically for the file handler since the date is encoded in the
filename.
from simple_log_factory import log_factory
logger = log_factory("my_app", log_file="./app.log")
Console + static file logger
from simple_log_factory import log_factory
logger = log_factory("my_app", log_file="./app.log", rotate_file_by_day=False)
Deduplicate handlers
Prevent duplicate output when multiple loggers write to the same destination:
from simple_log_factory import log_factory
logger = log_factory("my_app", unique_handler_types=True)
LogContext and LogContextGenerators
LogContextGenerators creates context-bound loggers that inject extra
key-value pairs into every log call:
from simple_log_factory import LogContextGenerators
gen = LogContextGenerators(log_name="my_app")
ctx = gen.get_logger_for_context(request_id="abc-123", user="alice")
ctx.info("Processing request") # extra={request_id: "abc-123", user: "alice"}
ctx.error("Something went wrong")
The returned LogContext object is a frozen dataclass with attributes
exception, error, warning, info, and debug.
Links
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_log_factory-1.0.0.tar.gz.
File metadata
- Download URL: simple_log_factory-1.0.0.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86fc6bbff7ea3eaef91b9b41b6a9ea754c56e52ea363a70e1386fe961b5d6bcb
|
|
| MD5 |
98fb52e6f985665640548a878774648c
|
|
| BLAKE2b-256 |
930bd284a35e187fd9c77cd2c1bd741b80994a91396a45c51016ef741ebd1291
|
Provenance
The following attestation bundles were made for simple_log_factory-1.0.0.tar.gz:
Publisher:
publish.yml on brenordv/log-factory-package
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_log_factory-1.0.0.tar.gz -
Subject digest:
86fc6bbff7ea3eaef91b9b41b6a9ea754c56e52ea363a70e1386fe961b5d6bcb - Sigstore transparency entry: 927202718
- Sigstore integration time:
-
Permalink:
brenordv/log-factory-package@7f6bd5c32256e6452d24d0b29625f5a0a31cab60 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/brenordv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f6bd5c32256e6452d24d0b29625f5a0a31cab60 -
Trigger Event:
push
-
Statement type:
File details
Details for the file simple_log_factory-1.0.0-py3-none-any.whl.
File metadata
- Download URL: simple_log_factory-1.0.0-py3-none-any.whl
- Upload date:
- Size: 31.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ea6c0793e0c227b6be6239325901f52ec3ec7abe78a28c699f3939f7facc6ae
|
|
| MD5 |
03680a8e20ee18c2a20e4b65e7d9e4d9
|
|
| BLAKE2b-256 |
d51f020e9072522172e0943691281a1888ac7cbdbbc76ea5a9783a29593722e0
|
Provenance
The following attestation bundles were made for simple_log_factory-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on brenordv/log-factory-package
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_log_factory-1.0.0-py3-none-any.whl -
Subject digest:
9ea6c0793e0c227b6be6239325901f52ec3ec7abe78a28c699f3939f7facc6ae - Sigstore transparency entry: 927202727
- Sigstore integration time:
-
Permalink:
brenordv/log-factory-package@7f6bd5c32256e6452d24d0b29625f5a0a31cab60 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/brenordv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f6bd5c32256e6452d24d0b29625f5a0a31cab60 -
Trigger Event:
push
-
Statement type: