Skip to content

Commit

Permalink
unify Fluent::Log::LOG_ROTATE_AGE for consistency
Browse files Browse the repository at this point in the history
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
  • Loading branch information
kenhys committed May 13, 2021
1 parent 9a10164 commit 627c841
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/fluent/command/fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@
opts[:log_path] = s
}

ROTATE_AGE = %w(daily weekly monthly)
op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age|
if ROTATE_AGE.include?(age)
if Fluent::Log::LOG_ROTATE_AGE.include?(age)
opts[:log_rotate_age] = age
else
begin
Expand Down
1 change: 1 addition & 0 deletions lib/fluent/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module TTYColor
LOG_TYPE_DEFAULT = :default # show logs in all supervisor/workers, with worker id in workers (default)

LOG_TYPES = [LOG_TYPE_SUPERVISOR, LOG_TYPE_WORKER0, LOG_TYPE_DEFAULT].freeze
LOG_ROTATE_AGE = %w(daily weekly monthly)

def self.str_to_level(log_level_str)
case log_level_str.downcase
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/system_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SystemConfig
config_param :format, :enum, list: [:text, :json], default: :text
config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S %z'
config_param :rotate_age, default: nil do |v|
if %w(daily weekly monthly).include?(v)
if Fluent::Log::LOG_ROTATE_AGE.include?(v)
v.to_sym
else
begin
Expand Down

0 comments on commit 627c841

Please sign in to comment.