LogTale - A python logging framework
A simple, easy to use logging framework that builds on top of the built-in logger module.
Installation
pip install logtale
Usage
Simple Usage:
import logtale.logtale as tale
def main():
logtale = tale.LogTale("example", "./example.toml")
logger = logtale.logger(__name__)
logger.debug("test - debug")
logger.info("test - info")
logger.warning("test - warning")
logger.error("test - error")
logger.critical("test - critical")
if __name__ == "__main__":
main()
Prepend/Postpend text to the log message:
logger.addFilter(filter.LogAppendFilter(prepend_text="ExamplePrepend"))
logger.addFilter(filter.LogAppendFilter(postpend_text="ExamplePostpend"))
Configuration File
Create a configuration file for logging settings using the templates/config_template.toml file as a template.
[output.colors]
# Set the colors associated with each debug level.
# Colors are only applied for logs printed to the console.
# The logging color feature can be enabled/disabled in '[output.console]' section.
DEBUG = '\033[1;36m'
INFO = '\033[1;38m'
WARNING = '\033[1;33m'
ERROR = '\033[1;35m'
CRITICAL = '\033[1;31m'
[output.file]
enable = true # enable/disable logging to a .log file (default=true)
level = "DEBUG" # the base log level for logging to a file (default=DEBUG)
path = "logs/" # the directory to create log files in (default=logs/)
format = "(%(asctime)s)[%(name)s][%(levelname)s]::%(message)s" # the log message format to use for file logging
name = "example.log" # the naming scheme of the log file, by default it's '<project_name>_<version>_<timestamp>.log'
[output.console]
enable = true # enable/disable logging to the console (default=true)
level = "DEBUG" # the base log level for logging to the console (default=DEBUG)
format = "[%(levelname)s]::%(message)s" # the log message format to use for console logging
use_colors = true # enable/disable the use of colors for log levels. colors can be customized in '[output.colors]' section.
Examples
Check the examples directory for example scripts and configuration files.
# ./examples/example.py
import logtale.logtale as tale
import logtale.filter as filter
def main():
logtale = tale.LogTale("example", "./example.toml")
logger = logtale.logger(__name__)
logger.addFilter(filter.LogAppendFilter(prepend_text="ExamplePrepend"))
logger.debug("test - debug")
logger.info("test - info")
logger.warning("test - warning")
logger.error("test - error")
logger.critical("test - critical")
if __name__ == "__main__":
main()
Example log console output
Example log file output
Metadata
Release files for logtale 0.0.11
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 |
|---|---|---|---|---|
| logtale-0.0.11.tar.gz | 109.7 kB | Without provenance | Details for logtale-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logtale-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for logtale-0.0.11-py3-none-any.whl |
Total release size: 127.2 kB
Release files / logtale-0.0.11.tar.gz
| Download URL | logtale-0.0.11.tar.gz |
|---|---|
| Size | 109.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51221993ac8697b11f5a4b90a4a14b202191e082a2bc2fbdf4be4bbf01a6a5cc
|
|
BLAKE2b-256 checksum How to use checksums |
ff8e53011433da82267e64e4d4d6b327fb5034ba4e3c3952dfd5bb7adc4f25e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / logtale-0.0.11-py3-none-any.whl
| Download URL | logtale-0.0.11-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f95e5e9a74822cbe256dd803920063eeaa553ea9b68ed641860e1ca4b300c5cd
|
|
BLAKE2b-256 checksum How to use checksums |
0c764bbf621da0a87de7751090edf48ce10abc70a41a27a95fdd8a1a3bfbd08c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for logtale 0.0.11
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.