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

add log rotation configuration for phi log #63

Merged
merged 3 commits into from
Dec 15, 2022

Conversation

egreer
Copy link
Contributor

@egreer egreer commented Dec 15, 2022

Fixes #62 and allows rotation configuration to be passed in along with the path. Rotation is disabled by default.

For more information on the defaults see https://apidock.com/ruby/Logger/new/class

README.md Outdated
@@ -48,6 +48,8 @@ Example:
```ruby
PhiAttrs.configure do |conf|
conf.log_path = Rails.root.join("log", "phi_access_#{Rails.env}.log")
conf.log_shift_age = 10 # how many logs to keep of `log_shift_size` or frequency to rotate (daily, weekly or monthly)
conf.log_shift_size = 100.megabyte # size in bytes when using `log_shift_age` as a number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this needs to be plural

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either works in rails.

README.md Outdated
@@ -48,6 +48,8 @@ Example:
```ruby
PhiAttrs.configure do |conf|
conf.log_path = Rails.root.join("log", "phi_access_#{Rails.env}.log")
conf.log_shift_age = 10 # how many logs to keep of `log_shift_size` or frequency to rotate (daily, weekly or monthly)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should include info about 0 == disabled here

@@ -2,4 +2,8 @@

PhiAttrs.configure do |conf|
conf.log_path = Rails.root.join('log', 'phi_access.log')

# Log Rotation - disabled by default
conf.log_shift_age = 0 # how many logs to keep of `shift_size`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should indicate here that 0 is "disabled"

@egreer egreer merged commit e79b8bd into main Dec 15, 2022
@egreer egreer deleted the 62-allow-logger-configuration branch December 15, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow Logger Configuration
2 participants