Skip to content

Suggestion: Support a compression step during rotation #2

@lilyball

Description

@lilyball

This crate looks like exactly what I want, except for one thing: I want to be able to gzip my logs during rotation.

This should be a configuration on the RollingFileAppender. If set, when the file is rolled over, it would be passed through a compression stage first, which causes all pending writes to block until the compression is finished. The appender would also have to use this flag to determine what filenames to check for when renaming existing logs, as the compressed logs would look something like prefix.1.gz.

At the API level, I need to be able to provide the file extension for rotated logs (probably as a const), and I'd need to be able to do the actual compression (probably as a blocking function that returns io::Result<()>). The compression function should take the source path and a temporary destination path (possibly just base_filename.ext, no log number). When the compression finishes this crate can then rename the destination path to the expected rotation path and delete the source log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions