Module: BufferedLogger::Formatting
- Included in:
- BufferedLogger
- Defined in:
- lib/buffered_logger/formatting.rb
Constant Summary
collapse
- DEFAULT_LEVEL =
:default
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
magic format getters/setters
33
34
35
36
37
38
39
40
|
# File 'lib/buffered_logger/formatting.rb', line 33
def method_missing(method, *args, &block)
case method.to_s
when /^(#{BufferedLogger::SEVERITY_LEVELS.join('|')})_formatter(=)?$/
$2 ? set_formatter($1.to_sym, args[0]) : formatter($1.to_sym)
else
super(method, *args, &block)
end
end
|
Instance Method Details
#color? ⇒ Boolean
12
|
# File 'lib/buffered_logger/formatting.rb', line 12
def color?; @color end
|
#disable_color ⇒ Object
14
|
# File 'lib/buffered_logger/formatting.rb', line 14
def disable_color; @color = false end
|
#enable_color ⇒ Object
15
|
# File 'lib/buffered_logger/formatting.rb', line 15
def enable_color; @color = true end
|
#initialize ⇒ Object
6
7
8
9
10
|
# File 'lib/buffered_logger/formatting.rb', line 6
def initialize
@formatter = BufferedLogger::ThreadHash.new { |h,k| h[k] = {} }
@color = stdout?
super()
end
|
#toggle_color ⇒ Object
13
|
# File 'lib/buffered_logger/formatting.rb', line 13
def toggle_color; @color = !@color end
|