Module: Fluent::PluginLoggerMixin

Included in:
Filter, Input, Output
Defined in:
lib/fluent/log.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logObject

Returns the value of attribute log.



360
361
362
# File 'lib/fluent/log.rb', line 360

def log
  @log
end

Class Method Details

.included(klass) ⇒ Object



347
348
349
350
351
352
# File 'lib/fluent/log.rb', line 347

def self.included(klass)
  klass.instance_eval {
    desc 'Allows the user to set different levels of logging for each plugin.'
    config_param :log_level, :string, default: nil, alias: :@log_level
  }
end

Instance Method Details

#configure(conf) ⇒ Object



362
363
364
365
366
367
368
369
370
371
# File 'lib/fluent/log.rb', line 362

def configure(conf)
  super

  if @log_level
    unless @log.is_a?(PluginLogger)
      @log = PluginLogger.new($log)
    end
    @log.level = @log_level
  end
end

#initializeObject



354
355
356
357
358
# File 'lib/fluent/log.rb', line 354

def initialize
  super

  @log = $log # Use $log object directly by default
end