ApplePyLog
Install with pip install applepylog
A simple logging library for small projects.
There are 4 Logging levels:
- Error
- Info
- Warn
- Debug
You can write to any of these levels and change the current log level of what gets printed from the logger The log levels work as the order above so a log level of Error will only print Error logs A log level of Warn will print Warn, Info and Error logs but not Debug The default log level is Warn
You can pass in any writer with type TextIO, the default is sys.stdout but you can also pass in file writers
You can also specify an alternate writer, which defaults to None, which will write the same as the main writer, this can be useful to write your logs to stdout and also save them to a file. This alternate writer also has its own log level that can be specified, also with default of WARN.
Basic Usage:
from applepylog import Logger
# Creates a logger to stdout
_logger = Logger("Test Logger")
_logger.info("test message") # logs "<timestamp> INFO Test Logger, test message"
_logger.debug("test message") # doesnt log anything because default log level is warn
Changing Log Level:
from applepylog import Logger, LogLevel
#Prints nothing because logger is in error level
_logger = Logger("Test Logger", log_level=LogLevel.ERROR)
_logger.info("test message")
Changing writer:
from applepylog import Logger
import sys
# Creates a logger to stderr
_logger = Logger("Test Logger", writer=sys.stderr)
_logger.info("test message")
# Creates a logger to a file
file = open("log_file.txt", "w+")
_other_logger = Logger("Test Logger", writer=file)
_other_logger.info("file test message")
Using the alternate writer:
from applepylog import Logger
import sys
file = open("./log_file.txt", "w+")
_logger = Logger("Test Logger", writer=sys.stdout, alt_writer=file)
# Writes same log message to both stdout and the log file
_logger.info("test message")
Using the alternate writer with a different log level:
from applepylog import Logger, LogLevel
import sys
file = open("./log_file.txt", "w+")
_logger = Logger("Test Logger", writer=sys.stdout, log_level=LogLevel.ERROR, alt_writer=file, alt_log_level=LogLevel.INFO)
# Writes to the log file but not stdout because of the Log levels of the writers
_logger.info("test message")
Metadata
Release files for applepylog 0.1.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 |
|---|---|---|---|---|
| applepylog-0.1.5.tar.gz | 3.7 kB | Without provenance | Details for applepylog-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| applepylog-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for applepylog-0.1.5-py3-none-any.whl |
Total release size: 6.6 kB
Release files / applepylog-0.1.5.tar.gz
| Download URL | applepylog-0.1.5.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53dffb579ab4f5064f32553228f0f30fd12aedc093a20b4c80de164f7bca0c20
|
|
BLAKE2b-256 checksum How to use checksums |
76de758abbb4b6956d573d7acd42a8f68d03d740688b86918e40d6f55a338697
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / applepylog-0.1.5-py3-none-any.whl
| Download URL | applepylog-0.1.5-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea9b8fad427ab6dc6e3045521b15d469495bb5ad029f40f35c3620f095fcd99b
|
|
BLAKE2b-256 checksum How to use checksums |
834f5c007477fb54d0eb4418a11378a1a23f43bd6662f3293265b4325bae803e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Security for applepylog 0.1.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.