q-logger-py
q-logger-py is a pure Python 3 logging library that use queues for handling log messages.
It is thread-based, which makes it faster than standard file logging.
Installation
pip install q-logger-py
Usage
first need to create a QueueHandler and a ThreadWorker (either ThreadStdoutWorker or ThreadRotateFileWorker).
Then, add the QueueHandler to your logger and start the ThreadWorker.
import logging
from q_logger_py import QueueHandler, ThreadStdoutWorker
queue_handler = QueueHandler()
thread_worker = ThreadStdoutWorker(queue_handler.log_queue)
logger = logging.getLogger(__name__)
logger.addHandler(queue_handler)
logger.setLevel(logging.DEBUG)
thread_worker.start()
logger.debug('This is a debug')
logger.info('This is a info')
logger.warning('This is a warning')
logger.error('This is an error')
thread_worker.end()
Features
- Thread-based: uses threads to handle log messages, which makes it faster than standard file logging.
- Queue-based: uses queues to store log messages, which ensures that no log messages are lost.
Custom Output
key features of q-logger-py is the ease of creating custom outputs.
By inheriting from the BaseThreadWorker class, you can define output method to handle records in any way you want.
from q_logger_py.worker.base_thread_worker import BaseThreadWorker
class ThreadFileWorker(BaseThreadWorker):
def __init__(self, log_queue, filename):
super().__init__(log_queue)
self.file = open(filename, 'a')
def output(self):
log_output = self.format(self.record)
# add custom output here
# self.file.write(log_output + '\n')
# self.file.flush()
print(log_output)
License
q-logger-py is licensed under the Apache License.
Project Links
Metadata
Release files for q-logger-py 0.0.3
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 |
|---|---|---|---|---|
| q-logger-py-0.0.3.tar.gz | 7.2 kB | Without provenance | Details for q-logger-py-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| q_logger_py-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for q_logger_py-0.0.3-py3-none-any.whl |
Total release size: 15.9 kB
Release files / q-logger-py-0.0.3.tar.gz
| Download URL | q-logger-py-0.0.3.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
549d92beac43d18cfbf755a8df4956479f69a155ef6ab3d23592dad65ed80717
|
|
BLAKE2b-256 checksum How to use checksums |
7d6f85c177f8b8c08e64ac8ffcf74e33c7080b66a9458223648009671a00d415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / q_logger_py-0.0.3-py3-none-any.whl
| Download URL | q_logger_py-0.0.3-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbb051fefe18cb0d705ff1a89624bcbad89dc3d0954a8199c7b9377bf10f978a
|
|
BLAKE2b-256 checksum How to use checksums |
e999f7445e5dada1aa78c483c3c519998e802ea016dc2c6951ab7f0c042956cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Security for q-logger-py 0.0.3
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.