LoggingOnTips
loggingontips is a Python package that simplifies logging setup and configuration. It eliminates the need for manual handling by allowing users to configure various logging parameters effortlessly, such as log file names and file rotations based on timestamps, file size, or the number of logs.
Features
- Customizable Logging: Set log file names and configure rotation settings with ease.
- File Rotation:
- By timestamp.
- By file size. (By default)
- By number of logs.
- Synchronous Logging: Fully supported.
- Thread Safe Logging: Fully supported.
- Asynchronous Logging: Coming soon in future releases!
Installation
Install the package using pip:
pip install loggingontips
Usage
Creating a simple log file with a single log
from loggingontips.Logger import Logger
from loggingontips.LogLevels import LogLevel
logger=Logger()
def run():
logger.log(LogLevel.INFO,'Is it working?')
if __name__=="__main__":
run()
Simulation of file rotation after exceeding size limit
from loggingontips.Logger import Logger
from loggingontips.LogLevels import LogLevel
l1=Logger()
#In this case log file should be rotated as size limit is 4 MB and logs are of 16 MB+
def run():
for i in range(10000000):
l1.log(LogLevel.DEBUG,'Working?')
if __name__=="__main__":
run()
Simulation of thread_safe_log() function [Should be called from threads]
import threading
import os
from loggingontips.LogLevels import LogLevel
from loggingontips.Logger import Logger
def test_thread_safe_log():
log_file = "test_thread_safe_log.log"
if os.path.exists(log_file):
os.remove(log_file)
logger = Logger(log_file=log_file)
def worker(thread_id):
for i in range(100):
logger.thread_safe_log(LogLevel.INFO, f"Thread-{thread_id} log message {i}")
threads = []
for thread_id in range(15):
thread = threading.Thread(target=worker, args=(thread_id,))
threads.append(thread)
thread.start()
for thread in threads:
thread.join()
logger.close()
if __name__ == "__main__":
test_thread_safe_log()
Metadata
Release files for loggingontips 0.1.2
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 |
|---|---|---|---|---|
| loggingontips-0.1.2.tar.gz | 4.0 kB | Without provenance | Details for loggingontips-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loggingontips-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for loggingontips-0.1.2-py3-none-any.whl |
Total release size: 8.9 kB
Release files / loggingontips-0.1.2.tar.gz
| Download URL | loggingontips-0.1.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe90986717bf7c6ac01a890adc71fefd89e30ad34a9bbcf1aa76c535d110d656
|
|
BLAKE2b-256 checksum How to use checksums |
b41e24604bb3993adc54ce48e3695f006b517def432dff9dcf80e17f2bec0ba3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Release files / loggingontips-0.1.2-py3-none-any.whl
| Download URL | loggingontips-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03d4c78939a4a6eee7635894669855a0b9898bf7689e3ae38393ff9dcd25df97
|
|
BLAKE2b-256 checksum How to use checksums |
e910164f5206af3f21f0f6c9534c46d43a620b12a723579abf8010ab5cab0cb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.12
|
Security for loggingontips 0.1.2
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.