Class: Elastics::Rails::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/elastics/rails/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



7
8
9
10
11
12
13
14
15
16
# File 'lib/elastics/rails/logger.rb', line 7

def initialize(*)
  super
  self.formatter = proc do |severity, datetime, progname, msg|
    elastics_formatted = elastics_format(severity, msg)
    ::Rails.logger.send(severity.downcase.to_sym, elastics_formatted) if log_to_rails_logger && ::Rails.logger.respond_to?(severity.downcase.to_sym)
    elastics_formatted if log_to_stderr
  end
  @log_to_rails_logger = true
  @log_to_stderr       = false
end

Instance Attribute Details

#log_to_rails_loggerObject

Returns the value of attribute log_to_rails_logger.



5
6
7
# File 'lib/elastics/rails/logger.rb', line 5

def log_to_rails_logger
  @log_to_rails_logger
end

#log_to_stderrObject

Returns the value of attribute log_to_stderr.



5
6
7
# File 'lib/elastics/rails/logger.rb', line 5

def log_to_stderr
  @log_to_stderr
end