sile / sloggers

A Rust library which provides frequently used slog loggers and convenient functions
MIT License
37 stars 18 forks source link

Add `restrict_permissions` to `FileLoggerBuilder` #51

Closed macladson closed 2 years ago

macladson commented 2 years ago

Resolves #17

This PR adds a new method to FileLoggerBuilder which restricts log file permissions such that they are only readable by the file owner. This corresponds to:

This is done specifically as a restriction rather than setting an arbitrary umask to ensure it worked across both Unix and Windows platforms.

sile commented 2 years ago

Thank you for your PR! I'll review it tomorrow. BTW, though the CI / Coverage failed, it seems not relevant to the changes in this PR. So you can ignore that (I'll investigate the cause later).

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 1414790960

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/file.rs 3 10 30.0%
src/permissions.rs 0 7 0.0%
<!-- Total: 3 17 17.65% -->
Files with Coverage Reduction New Missed Lines %
src/config.rs 1 35.71%
src/misc.rs 1 55.0%
src/syslog/drain.rs 1 93.55%
src/syslog/facility.rs 1 39.72%
../../../../../usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-channel-0.5.1/src/context.rs 1 70.49%
../../../../../usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-channel-0.5.1/src/flavors/array.rs 1 86.87%
../../../../../usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-channel-0.5.1/src/flavors/tick.rs 1 0.0%
../../../../../usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/once_cell-1.8.0/src/imp_std.rs 1 84.0%
../../../../../usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-async-2.7.0/lib.rs 1 94.37%
../../../../../usr/share/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-term-2.8.0/src/lib.rs 1 59.71%
<!-- Total: 21 -->
Totals Coverage Status
Change from base Build 1132511506: -0.4%
Covered Lines: 1621
Relevant Lines: 3301

💛 - Coveralls
macladson commented 2 years ago

Thank you for the quick review and merge!