Custom log with rotations
Project description
Log Functions
Install
pip install ddcLogs
BasicLog
- Setup Logging
from ddcLogs import BasicLog
log = BasicLog(level="info")
log.init()
SizeRotatingLog
- Setup Logging
- Logs will rotate based on the file size
- Logs will be deleted based on the
days_to_keep
variable, defaults to 30
from ddcLogs import SizeRotatingLog
log = SizeRotatingLog(
level = "info",
directory = "logs",
filenames = ["app.log", "app1.log"],
days_to_keep = 7,
max_mbytes = 5,
name = "app",
stream_handler = True,
show_location = False # this will show the filename and the line number where the message originated
)
log.init()
TimedRotatingLog
- Setup Logging
- Logs will rotate based on
when
variable to a.gz
file, defaults tomidnight
- Logs will be deleted based on the
days_to_keep
variable, defaults to 30 - Current 'when' events supported:
- S - Seconds
- M - Minutes
- H - Hours
- D - Days
- midnight - roll over at midnight
- W{0-6} - roll over on a certain day; 0 - Monday
- Logs will rotate based on
from ddcLogs import TimedRotatingLog
log = TimedRotatingLog(
level = "info",
directory = "logs",
filenames = ["app.log", "app1.log"],
days_to_keep = 7,
when = "midnight",
utc = True,
name = "app",
stream_handler = True,
show_location = False # this will show the filename and the line number where the message originated
)
log.init()
Source Code
Build
poetry build -f wheel
Publish to test pypi
poetry publish -r test-pypi
Publish to pypi
poetry publish
Run Tests
poetry run coverage run -m pytest -v
Get Coverage Report
poetry run coverage report
License
Released under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ddclogs-2.0.3.tar.gz
(6.1 kB
view hashes)