Singleton Logging Service
Logging service that is guaranteed to be a singleton. Based on Python logging, but every instantiation of LoggingService from any of an application's modules returns the same logger instance.
###Examples:
from logging_service import LoggingService
self.log = LoggingService()
self.log.info("Constructing output file names...")
self.log.err("Failed to construct output file names...")
self.log.warn("Output file names are unusual...")
self.log.debug("Constructing output file names foo.bar, fum.txt...")
This API is more primitive than the hierarchical native logging module, but hopefully simple to use. One can:
- Log to a file,
- The console, or
- Both
For convenience, the logging levels logging.DEBUG, logging.INFO, etc. are available in this package as enums: LoggingLevel.DEBUG, LoggingLevel.INFO, etc. Just import LoggingLevel with LoggingService.
A single formatter is built in for info/debug/warn/err. Example:
my_module.py(290375): 2020-09-03 14:58:33,017;INFO: Start Epoch [1/50]
When first creating a LoggingService instance, the following options are available in the constructor; all are optional:
logging_level=LoggingLevel.INFO # equivalent to the Python logging package's constants
logfile=None, # destination file; None implies console only
tee_to_console=True, # if logfile is specified, also log to console
msg_identifier=None, # shown at start of each msg; default is module name
rotating_logs=True, # if logging to file, rotate log if size exceeded
log_size=1000000, # max log size for rotation
max_num_logs=500, # max number of full logs to retain
logger_name=None # name for the logger instance
After creation a logger instance may only be modified like this:
- my_logger.logging_level = LoginLevel.<NEW_LEVEL>
- my_logger.log_file = '/tmp/new_logfile'
where logging levels are the usual logging.INFO, logging.WARN, etc.
Metadata
Release files for logging-singleton 1.0.4
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 | |
|---|---|---|---|---|
| logging_singleton-1.0.4.tar.gz | 9.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logging_singleton-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / logging_singleton-1.0.4.tar.gz
| Download URL | logging_singleton-1.0.4.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9201423ea044d076e93cc28061b9a6f4e2f5557d888f77453a018932f57fdba8
|
|
BLAKE2b-256 checksum How to use checksums |
93fbd3c6b8816f9a6f29abcb453ba2cc1f4294399b2e89a30208077f2ce635cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / logging_singleton-1.0.4-py3-none-any.whl
| Download URL | logging_singleton-1.0.4-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6fbeab32a76def9115bfdbcfb078bfaa8d7ec8d3f80dfe2fe6848c9b8a92658
|
|
BLAKE2b-256 checksum How to use checksums |
63df969b17ba88b9576ca0df7016561fb1ebd365b7b0f9e91559f007cd00f460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for logging-singleton 1.0.4
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.