Class: Fluent::Logger::LoggerBase

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/logger/base.rb

Direct Known Subclasses

DefaultLogger, FluentLogger, TestLogger, TextLogger

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.open(*args, &block) ⇒ Object



23
24
25
# File 'lib/fluent/logger/base.rb', line 23

def self.open(*args, &block)
  Fluent::Logger.open(self, *args, &block)
end

Instance Method Details

#create_event(tag, *args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fluent/logger/base.rb', line 27

def create_event(tag, *args)
  map = {}
  keys = []
  args.each {|a|
    case a
    when Hash
      a.each_pair {|k,v|
        keys << k.to_sym
        map[k.to_sym] = v
      }
    else
      keys << a.to_sym
    end
  }

  m = Module.new
  m.module_eval do
    keys.each {|key|
      define_method(key) do |v|
        with(key=>v)
      end
      define_method(:"#{key}!") do |v|
        with!(key=>v)
      end
    }
    define_method(:MODULE) { m }
  end

  e = TerminalEvent.new(self, tag, map)
  e.extend(m)
  e
end