Class: Elastics::Logger
- Inherits:
-
Logger
- Object
- Logger
- Elastics::Logger
- Defined in:
- lib/elastics/logger.rb
Instance Attribute Summary collapse
-
#curl_format ⇒ Object
Returns the value of attribute curl_format.
-
#debug_request ⇒ Object
Returns the value of attribute debug_request.
-
#debug_result ⇒ Object
Returns the value of attribute debug_result.
-
#debug_variables ⇒ Object
Returns the value of attribute debug_variables.
Instance Method Summary collapse
- #elastics_format(severity, msg) ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/elastics/logger.rb', line 9 def initialize(*) super self.level = ::Logger::WARN self.progname = 'ELASTICS' self.formatter = proc do |severity, datetime, progname, msg| elastics_format(severity, msg) end @debug_variables = true @debug_request = true @debug_result = true @curl_format = false end |
Instance Attribute Details
#curl_format ⇒ Object
Returns the value of attribute curl_format.
7 8 9 |
# File 'lib/elastics/logger.rb', line 7 def curl_format @curl_format end |
#debug_request ⇒ Object
Returns the value of attribute debug_request.
7 8 9 |
# File 'lib/elastics/logger.rb', line 7 def debug_request @debug_request end |
#debug_result ⇒ Object
Returns the value of attribute debug_result.
7 8 9 |
# File 'lib/elastics/logger.rb', line 7 def debug_result @debug_result end |
#debug_variables ⇒ Object
Returns the value of attribute debug_variables.
7 8 9 |
# File 'lib/elastics/logger.rb', line 7 def debug_variables @debug_variables end |
Instance Method Details
#elastics_format(severity, msg) ⇒ Object
22 23 24 25 |
# File 'lib/elastics/logger.rb', line 22 def elastics_format(severity, msg) prefix = Dye.dye(" ELASTICS-#{severity} ", "ELASTICS-#{severity}:", :blue, :bold, :reversed) + ' ' msg.split("\n").map{|l| prefix + l}.join("\n") + "\n" end |