printx
printx is a Python package that provides a convenient print-like function for logging messages with various log levels, making it easy to integrate logging into your projects.
Installation
You can install printx via pip:
pip install printx
Usage
from printx import printx_configure, printx
# Configure logging (optional: specify a custom log filename)
printx_configure()
# Use the printx function
printx("This is a default info message")
printx("This is a debug message", log_level='debug')
printx("This is an info message", log_level='info')
printx("This is a warning message", log_level='warning')
printx("This is an error message", log_level='error')
printx("This is a critical message", log_level='critical')
def example_function():
try:
printx("Starting the function")
printx("Performing an action")
error_condition = True # Simulate an error condition
if error_condition:
raise ValueError("An error occurred")
printx("Function finished")
except Exception as e:
printx(f"Exception occurred: {e}", log_level='error')
example_function()
Configuration
The printx_configure function allows you to configure the logging settings. By default, it logs messages to a file named after the script that uses the printx function and to the console.
To configure logging:
from printx import printx_configure
Configure logging with default settings
printx_configure()
Configure logging with a custom log filename
printx_configure(log_filename='custom_log.log')
Configure logging with a different log level
printx_configure(level=logging.WARNING)
The printx_configure function accepts the following parameters:
log_filename(str, optional): The name of the log file. If not provided, the default is the script's name with a.logextension.level(int, optional): The logging level. Default islogging.DEBUG.
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
Author
Acknowledgments
- Thanks to the open-source community for providing the tools and inspiration for this project.
- Special thanks to all contributors and users of the package.
Metadata
Release files for printx 1.0.1
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 |
|---|---|---|---|---|
| printx-1.0.1.tar.gz | 2.6 kB | Without provenance | Details for printx-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| printx-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for printx-1.0.1-py3-none-any.whl |
Total release size: 5.4 kB
Release files / printx-1.0.1.tar.gz
| Download URL | printx-1.0.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
710dce9f4730abda61ea784048f57a8f07446dcb5a1cc3302ed0f76d8ce2b9f3
|
|
BLAKE2b-256 checksum How to use checksums |
7e158e09a3e47cbe0147b37a724d8ec5b95aa59d50f259bcd3ec1d74cf4045b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.11
|
Release files / printx-1.0.1-py3-none-any.whl
| Download URL | printx-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2057d9968cc10c8aaea15c257349577b8c4e10537be730c530559c5469775846
|
|
BLAKE2b-256 checksum How to use checksums |
c632c2cc34ec4eef602d529b729c1879d6e2e75708a66bd798fe7e8f22a534a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.10.11
|
Security for printx 1.0.1
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.