Class: Flex::Logger
- Inherits:
-
Logger
- Object
- Logger
- Flex::Logger
- Defined in:
- lib/flex/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
- #color ⇒ Object
-
#color=(bool) ⇒ Object
force color in console (used with jruby).
- #flex_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/flex/logger.rb', line 9 def initialize(*) super self.level = ::Logger::WARN self.progname = 'FLEX' self.formatter = proc do |severity, datetime, progname, msg| flex_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/flex/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/flex/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/flex/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/flex/logger.rb', line 7 def debug_variables @debug_variables end |
Instance Method Details
#color ⇒ Object
32 33 34 |
# File 'lib/flex/logger.rb', line 32 def color Dye.color? end |
#color=(bool) ⇒ Object
force color in console (used with jruby)
28 29 30 |
# File 'lib/flex/logger.rb', line 28 def color=(bool) Dye.color = bool end |
#flex_format(severity, msg) ⇒ Object
22 23 24 25 |
# File 'lib/flex/logger.rb', line 22 def flex_format(severity, msg) prefix = Dye.dye(" FLEX-#{severity} ", "FLEX-#{severity}:", :blue, :bold, :reversed) + ' ' msg.split("\n").map{|l| prefix + l}.join("\n") + "\n" end |