Class: Ktl::ShellFormater
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Ktl::ShellFormater
- Defined in:
- lib/ktl/shell_formatter.rb
Instance Method Summary collapse
- #call(severity, time, progname, msg) ⇒ Object
-
#initialize(shell) ⇒ ShellFormater
constructor
A new instance of ShellFormater.
Constructor Details
#initialize(shell) ⇒ ShellFormater
Returns a new instance of ShellFormater.
5 6 7 8 |
# File 'lib/ktl/shell_formatter.rb', line 5 def initialize(shell) @shell = shell @padding = ' ' * 2 end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ktl/shell_formatter.rb', line 10 def call(severity, time, progname, msg) severity_part = sprintf('%-5s', severity.downcase) severity_part = @shell.set_color(severity_part, color_for[severity]) line = %(#{@padding}#{severity_part} #{msg2str(msg)}) line << NEWLINE unless line.end_with?(NEWLINE) line end |