A Python logging utility that generates indented log messages with color-coding for different log levels on the console, and also supports logging to files for better tracking and debugging.
Project description
tidy-logger
A repository for a Python logging utility that generates indented log messages with color-coding for different log levels on the console, and also supports logging to files for better tracking and debugging.
[!NOTE] Development for this repository follows the GitFlow workflow.
Installation
To install the tidy-logger package, run the following command:
pip install tidy-logger
Usage
Here’s an example of how to use the tidy-logger utility in a Python project. Start by creating a file named test_module.py, as shown below:
import logging
from tidy_logger import TidyLogger
# Initialize the TidyLogger instance
logger = TidyLogger(app_name="AwesomeApp", app_author="GreatAuthor", log_file_name="journal", console_level=logging.DEBUG)
def some_function() -> None:
# Example log messages
logger.debug("This is a debug message - Used for debugging during development.")
logger.info("This is an info message - General application information.")
logger.warning("This is a warning message - Something might need attention.")
logger.error("This is an error message - Something went wrong!")
logger.critical("This is a critical message - Serious error, action required!")
if __name__ == "__main__":
some_function()
Run the newly created module using the following command:
python -m test_module.py
Console Output
The logs will appear on the console with color-coded log levels, as shown below:
Options
The environment variable TIDY_LOGGER_LOG_FILE_DIR can be set to specify the log file directory if the log_file_directory argument is not provided during the initialization of TidyLogger. It is recommended to set this environment variable to an absolute path.
Similarly, the environment variable TIDY_LOGGER_LOG_FILE_NAME can be set to set to specify the log file name if the log_file_name argument is not provided.
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 tidy_logger-1.0.0.tar.gz.
File metadata
- Download URL: tidy_logger-1.0.0.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cbd65cf93e2614f4c84ac278cb8a3185b28e3f75edb8158e74d18d68b6b06c7
|
|
| MD5 |
9708fdb79d4c70d0ffcfa5433b3f6284
|
|
| BLAKE2b-256 |
70bc8ff9a5f85e7b6e58b2849418f14a008ff18d91e20690a0e66f2c9629144f
|
Provenance
The following attestation bundles were made for tidy_logger-1.0.0.tar.gz:
Publisher:
workflow_publish_to_pypi.yml on fa-vahidi/tidy-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tidy_logger-1.0.0.tar.gz -
Subject digest:
8cbd65cf93e2614f4c84ac278cb8a3185b28e3f75edb8158e74d18d68b6b06c7 - Sigstore transparency entry: 905071873
- Sigstore integration time:
-
Permalink:
fa-vahidi/tidy-logger@c90fbd10eea7252e0457c7357d5773f2e1e42994 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/fa-vahidi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow_publish_to_pypi.yml@c90fbd10eea7252e0457c7357d5773f2e1e42994 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tidy_logger-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tidy_logger-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.1 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 |
2b5506a8c9a7b11c001da54f23986d8dfcba459327860f9c80d404ff06f77b44
|
|
| MD5 |
8ec540b88816fd320d0dfdf61715be7d
|
|
| BLAKE2b-256 |
00110f189d67199caa365640d1f6bef816d665185d62fba746fd9911a2d93c97
|
Provenance
The following attestation bundles were made for tidy_logger-1.0.0-py3-none-any.whl:
Publisher:
workflow_publish_to_pypi.yml on fa-vahidi/tidy-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tidy_logger-1.0.0-py3-none-any.whl -
Subject digest:
2b5506a8c9a7b11c001da54f23986d8dfcba459327860f9c80d404ff06f77b44 - Sigstore transparency entry: 905071913
- Sigstore integration time:
-
Permalink:
fa-vahidi/tidy-logger@c90fbd10eea7252e0457c7357d5773f2e1e42994 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/fa-vahidi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow_publish_to_pypi.yml@c90fbd10eea7252e0457c7357d5773f2e1e42994 -
Trigger Event:
push
-
Statement type: