Class: LaLogger::Logger

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/la_logger.rb

Overview

singleton logger object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/la_logger.rb', line 20

def initialize
  if ENV['FLUENTD']
    host_, port_ = ENV['FLUENTD'].split ':'
    host_ ||= 'localhost'
    port_ ||= 24224
    @logger = Fluent::Logger::FluentLogger.new(
      ENV['FLUENTD_TAG'], host: host_.to_s, port: port_.to_i
    )
  else
    @logger = Fluent::Logger::ConsoleLogger.open($stderr)
  end
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



18
19
20
# File 'lib/la_logger.rb', line 18

def logger
  @logger
end