LoggerUtility
LoggerUtility is a Python class that simplifies logging setup across your Python applications. It provides a streamlined way to configure loggers with custom formats, different logging levels, and optional file output. Whether you're debugging during development or monitoring in production, LoggerUtility can help you keep clear and concise logs.
Features
- Easy logger configuration with just a few lines of code.
- Customizable log message format.
- Optional date formatting in log messages.
- Support for logging to console or files.
- Convenience methods for various logging levels (
debug,info,warning,error,critical).
Installation
You can simply copy the LoggerUtility class into your project, or if you have it packaged, you can install it via pip (assuming you have it available on PyPI):
pip install cd-logging
Update
pip install -U cd-logging
Usage
Here is a quick example of how to use LoggerUtility:
from cd_logging.cd_logging import LoggerUtility
# Initialize the logger
logger_util = LoggerUtility(__name__, level=logging.INFO)
# Log some messages
logger_util.info("Application is starting...")
logger_util.warning("An optional warning message.")
logger_util.error("An error occurred.")
# Log a critical message with exception traceback
try:
raise ValueError("An example exception.")
except Exception:
logger_util.critical("A critical error occurred.", exc_info=True)
Configuration
When initializing the LoggerUtility, you can customize the following:
name: The logger's name, typically set to__name__to reflect the module's name.level: The threshold for the logging messages (e.g.,logging.DEBUG,logging.INFO).log_format: Custom format for the log messages.date_format: Custom date format for the log messages.filename: If set, logs will be directed to the specified file.
Documentation
For more details on how to use and configure LoggerUtility, please refer to the inline documentation within the class itself. Each method and initializer parameter is thoroughly documented with docstrings.
More documentation at: Code Docta
Contributing
We welcome contributions from the community! If you'd like to contribute, feel free to fork the repository, make your changes, and submit a pull request.
License
LoggerUtility is licensed under the MIT License. See the LICENSE file for more details.
Contact
If you have any questions or feedback, please open an issue in the GitHub repository, and we will get back to you as soon as possible.
Metadata
Release files for cd-logging 0.0.5
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 |
|---|---|---|---|---|
| cd_logging-0.0.5.tar.gz | 4.1 kB | Without provenance | Details for cd_logging-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cd_logging-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for cd_logging-0.0.5-py3-none-any.whl |
Total release size: 9.4 kB
Release files / cd_logging-0.0.5.tar.gz
| Download URL | cd_logging-0.0.5.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
563f6287b4628689f9274131636c065ba6d5b9d3000cee678543d3995ffcfa6f
|
|
BLAKE2b-256 checksum How to use checksums |
8f01fd811258b477f7066fdb534ef13813f0d2d8befdf0f73a05df9eeb24c2cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / cd_logging-0.0.5-py3-none-any.whl
| Download URL | cd_logging-0.0.5-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b77c539f19d0cb5927e982562b940462120798ed810dd1d2dc39afc6715f49ef
|
|
BLAKE2b-256 checksum How to use checksums |
42c8e22f397382fdd1072a7ce8ab11ae84260e3b54a8ed08e2b4d9c0fbf013cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for cd-logging 0.0.5
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.