Class: ActiveSupport::BufferedLogger
- Inherits:
-
Object
- Object
- ActiveSupport::BufferedLogger
show all
- Includes:
- Severity
- Defined in:
- lib/color-debug.rb
Defined Under Namespace
Modules: Colors, Severity
Constant Summary
Constants included
from Severity
Severity::COLORIZE
Instance Method Summary
collapse
Instance Method Details
#add(severity, message = nil, progname = nil, color = nil, &block) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/color-debug.rb', line 19
def add(severity, message = nil, progname = nil, color = nil, &block)
return if @level > severity
message = (message || (block && block.call) || progname).to_s
color ||= Colors::MAGENTA
message = "#{color}#{message}#{Colors::EC}\n" if severity == 10
message = "#{message}\n" unless message[-1] == ?\n
buffer << message
auto_flush
message
end
|