Module: Fluent::TimeMixin::TimeParameters

Includes:
Configurable
Defined in:
lib/fluent/time.rb

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Method Summary collapse

Methods included from Configurable

#config, #configure_proxy_generate, #configured_section_create, included, #initialize, lookup_type, register_type

Instance Method Details

#configure(conf) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/fluent/time.rb', line 133

def configure(conf)
  if conf.has_key?('localtime') || conf.has_key?('utc')
    if conf.has_key?('localtime') && conf.has_key?('utc')
      raise Fluent::ConfigError, "both of utc and localtime are specified, use only one of them"
    elsif conf.has_key?('localtime')
      conf['localtime'] = Fluent::Config.bool_value(conf['localtime'])
    elsif conf.has_key?('utc')
      conf['localtime'] = !(Fluent::Config.bool_value(conf['utc']))
      # Specifying "localtime false" means using UTC in TimeFormatter
      # And specifying "utc" is different from specifying "timezone +0000"(it's not always UTC).
      # There are difference between "Z" and "+0000" in timezone formatting.
      # TODO: add kwargs to TimeFormatter to specify "using localtime", "using UTC" or "using specified timezone" in more explicit way
    end
  end

  super

  Fluent::Timezone.validate!(@timezone) if @timezone
end