Use constant for magic number

This commit is contained in:
yoshihara 2015-04-21 12:12:47 +09:00
parent c591734ede
commit f4381a81fd

View File

@ -1,6 +1,8 @@
class Fluentd
module Setting
class InTail
MULTI_LINE_MAX_FORMAT_COUNT = 20
include ActiveModel::Model
attr_accessor :path, :tag, :format, :regexp, :time_format, :rotate_wait, :pos_file, :read_from_head, :refresh_interval
@ -18,7 +20,7 @@ class Fluentd
:ltsv => [:delimiter, :time_key],
:json => [:time_key],
:regexp => [:time_format, :regexp],
:multiline => [:format_firstline] + (1..20).map{|n| "format#{n}".to_sym }
:multiline => [:format_firstline] + (1..MULTI_LINE_MAX_FORMAT_COUNT).map{|n| "format#{n}".to_sym }
# TODO: Grok could generate Regexp including \d, \s, etc. fluentd config parser raise error with them for escape sequence check.
# TBD How to handle Grok/Regexp later, just comment out for hide
# :grok => [:grok_str],