Class: Elastics::Rails::Logger
- Inherits:
-
Logger
- Object
- Logger
- Elastics::Rails::Logger
- Defined in:
- lib/elastics/rails/logger.rb
Instance Attribute Summary collapse
-
#log_to_rails_logger ⇒ Object
Returns the value of attribute log_to_rails_logger.
-
#log_to_stderr ⇒ Object
Returns the value of attribute log_to_stderr.
Instance Method Summary collapse
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize ⇒ Logger
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_logger ⇒ Object
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_stderr ⇒ Object
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 |