Module: Fluent::Logger

Defined in:
lib/fluent/logger.rb,
lib/fluent/logger/version.rb,
lib/fluent/logger/logger_base.rb,
lib/fluent/logger/null_logger.rb,
lib/fluent/logger/test_logger.rb,
lib/fluent/logger/text_logger.rb,
lib/fluent/logger/fluent_logger.rb,
lib/fluent/logger/console_logger.rb,
lib/fluent/logger/fluent_logger/cui.rb,
lib/fluent/logger/level_fluent_logger.rb

Defined Under Namespace

Classes: ConsoleLogger, EventTime, FluentLogger, LevelFluentLogger, LoggerBase, NullLogger, TestLogger, TextLogger

Constant Summary collapse

VERSION =
'0.7.2'
@@default_logger =
nil

Class Method Summary collapse

Class Method Details

.closeObject


45
46
47
48
49
50
# File 'lib/fluent/logger.rb', line 45

def self.close
  if @@default_logger
    @@default_logger.close
    @@default_logger = nil
  end
end

.defaultObject


60
61
62
# File 'lib/fluent/logger.rb', line 60

def self.default
  @@default_logger ||= ConsoleLogger.new(STDOUT)
end

.default=(logger) ⇒ Object


64
65
66
# File 'lib/fluent/logger.rb', line 64

def self.default=(logger)
  @@default_logger = logger
end

.new(*args) ⇒ Object


31
32
33
34
35
36
37
38
# File 'lib/fluent/logger.rb', line 31

def self.new(*args)
  if args.first.is_a?(Class) && args.first.ancestors.include?(LoggerBase)
    type = args.shift
  else
    type = FluentLogger
  end
  type.new(*args)
end

.open(*args) ⇒ Object


40
41
42
43
# File 'lib/fluent/logger.rb', line 40

def self.open(*args)
  close
  @@default_logger = new(*args)
end

.post(tag, map) ⇒ Object


52
53
54
# File 'lib/fluent/logger.rb', line 52

def self.post(tag, map)
  default.post(tag, map)
end

.post_with_time(tag, map, time) ⇒ Object


56
57
58
# File 'lib/fluent/logger.rb', line 56

def self.post_with_time(tag, map, time)
  default.post_with_time(tag, map, time)
end