Skip to main content

switchinglogfilehandlers

A collection of switching log file handlers for the Python logging system. Unlike the rotating log file handlers in the Python core which always write to a file with a fixed name and peridically rename that, these handlers always open a new file with a unique name - old files will never be renamed.

TimedSwitchingFileHandler

This file handler starts a new file at regular intervals, comparable to the TimedRotatingFileHandler. The switch always occurs at a “round” time, i.e. at the hour for hourly switches, at midnight for daily switches, etc. The old file stays open until just before the first log entry is written to the new file.

Parameters

Parameter Default Description
filename (required) Path to the log files. The timestamp and .log is appended
when 'h' When log files are switched: (every second, minute, hour, day, week)
utc False Timestamps are in UTC (otherwise local time)
create_directory False Intermediate directories in filename are created if necessary

TimeoutSwitchingFileHandler

This file handler automatically closes the log file after a period of inactivity (or after the file has been open for some time whichever comes first) and then opens a new file at the next emit.

This is useful for long-running processes where short periods of activity alternate with periods of inactivity. Log switchse will typically occur during inactivity, so each log file will include one complete active period. Also, since the log files are closed, they can be safely compressed or removed.

Parameters

Parameter Default Description
filename (required) Path to the log files. The timestamp is appended
min_timeout 60 Logfile is closed if there hasn't been any activity for min_timeout seconds
max_timeout 3600 Logfile is closed if is has been created max_timeout seconds ago
create_directory False Intermediate directories in filename are created if necessary

Metadata

Release files for switchinglogfilehandlers 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for switchinglogfilehandlers 0.0.5
File Size Uploaded Provenance Actions
switchinglogfilehandlers-0.0.5.tar.gz 4.6 kB Without provenance Details for switchinglogfilehandlers-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for switchinglogfilehandlers 0.0.5
File Interpreter ABI Platform Actions
switchinglogfilehandlers-0.0.5-py3-none-any.whl Python 3 none any Details for switchinglogfilehandlers-0.0.5-py3-none-any.whl

Total release size: 8.4 kB

Release files / switchinglogfilehandlers-0.0.5.tar.gz

Download URL switchinglogfilehandlers-0.0.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4bf8b9fee8ddc93831654f0a5301d711774c9d8144e9574250b72b96af53350a
BLAKE2b-256 checksum
How to use checksums
592ba0a68837faad97607933bc8155374574bd6132797805aa25a1658258e5a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release files / switchinglogfilehandlers-0.0.5-py3-none-any.whl

Download URL switchinglogfilehandlers-0.0.5-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0caeb79ba676c58c25f3248432024c4ed08a509732e1ed09a186f2414a646f2
BLAKE2b-256 checksum
How to use checksums
ac638785dba53e27ffe67301834f955fc7813aae905388005ecd534e8ff52241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Security for switchinglogfilehandlers 0.0.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page