Module: Fluent::Plugin::LoggerSupport

Included in:
MongoStorage
Defined in:
lib/fluent/plugin/logger_support.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
8
# File 'lib/fluent/plugin/logger_support.rb', line 3

def self.included(klass)
  klass.instance_eval {
    desc "MongoDB log level"
    config_param :mongo_log_level, :string, default: 'info'
  }
end

Instance Method Details

#configure_logger(mongo_log_level) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fluent/plugin/logger_support.rb', line 10

def configure_logger(mongo_log_level)
  Mongo::Logger.level = case @mongo_log_level.downcase
                        when 'fatal'
                          Logger::FATAL
                        when 'error'
                          Logger::ERROR
                        when 'warn'
                          Logger::WARN
                        when 'info'
                          Logger::INFO
                        when 'debug'
                          Logger::DEBUG
                        end
end