Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing file permissions on rotate #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Oct 22, 2024

  1. Define defaultFileMode variable

    Just to make it clearer what's the default. Also use it in tests.
    
    Signed-off-by: Anna Kapuscinska <[email protected]>
    lambdanis committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    7c4a82b View commit details
    Browse the repository at this point in the history
  2. Allow changing file permissions on rotate

    Since 4d704c9 lumberjack allows to set the permission bits on log files
    via Logger.FileMode field. However, if the file already existed then its
    permissions were preserved even after log rotation or when a new Logger was
    created, so the FileMode field was effectively ignored.
    
    This commit changes that behaviour. If FileMode field is set to a different
    value than permissions on the existing file, then file permissions are not
    changed immediately, but after log rotation the new file has new permissions.
    This allows to change permissions on the log file programatically, without
    a need for manual operation.
    
    Signed-off-by: Anna Kapuscinska <[email protected]>
    lambdanis committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    d926000 View commit details
    Browse the repository at this point in the history