logset
Convenience functions for setting up console and file loggers with a single call.
About
Python's logging library is powerful, but comes with a steep learning curve and several common "gotchas". The logset library helps address this by providing convenience functions for setting up basic console (sys.stderr) and file logs. Each function lets you configure a log at a given logging level using a single function call.
Critically, logset requires minimal familiarity with the logging library, so developers can simply focus on what their logs should do, without needing to manage complex logging objects. The commands also help prevent issues wherein (1) messages are not logged as expected, and (2) messages are duplicated in a logging target.
Examples
Log messages to the console (sys.stderr) at a given level:
import logset
logset.console.debug("my-logger") # Logs at the DEBUG level
logset.console.info("my-logger") # Logs at the INFO level
# Also includes functions for the "warning", "error", and "critical" levels
Log messages to file at a given level:
logset.file.debug("my-logger", "my-file.log")
logset.file.info("my-logger", "my-file.log")
# Also includes functions for the "warning", "error", and "critical" levels
Control when log files are opened/created:
logset.file.debug("my-logger", "path/to/some/my-file.log", make_parents=True)
logset.file.debug("my-logger", "my-file.log", delay=True)
Customize the format of different logs:
logset.console.info("my-logger", "%(message)s")
logset.file.debug("my-logger", "my-file.log", "%(asctime)s - %(name)s - %(message)s)
Log to a file that rotates after reaching a maximum allowed size:
# Rotates after reaching 1MB, saving backups of the 2 most recent rotated logs
logset.file.info("my-logger", "my-file.log", rotate_bytes=1000000, backup_count=2)
Log to a file that rotates on a fixed time interval:
# Rotates after 7 days, saving backups of the 2 previous logs
logset.file.info(
"my-logger", "my-file.log", rotate_when="D", rotate_interval=7, backup_count=2
)
Documentation
You can find more detailed examples, a user guide, and a comprehensive reference API at the project documentation.
Installation
Requires: Python 3.11+
Dependencies: None
pip install logset
Contributing / Feedback
We welcome contributions and feedback! To ask a question, suggest a feature, or report a bug, please open a new thread on our Issues tracker. If you plan to contribute code, please read the contribution guide in the docs.
License
This project is licensed under the MIT license. Refer to the license file for more details.
Metadata
Release files for logset 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logset-1.1.0.tar.gz | 10.4 kB | Without provenance | Details for logset-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logset-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for logset-1.1.0-py3-none-any.whl |
Total release size: 26.1 kB
Release files / logset-1.1.0.tar.gz
| Download URL | logset-1.1.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cac8bedcae139818bf515e2b2990982459e725886abed891b5c0ecbffe3ab22
|
|
BLAKE2b-256 checksum How to use checksums |
a952baf6dd5b36def240c54da07e66fc562f5658513c80905431f76924fdd7c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / logset-1.1.0-py3-none-any.whl
| Download URL | logset-1.1.0-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13d4f23e5e4572c0f48efa435c27cb011a24db8ebca2c81882ecee2f522619bb
|
|
BLAKE2b-256 checksum How to use checksums |
08e3d533e1bc87aed40b3211ced0b9bd3978e2228fe803bb817c04320148bf5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for logset 1.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.