Class: MJ::Logging::BasicLayout
- Inherits:
-
Logging::Layout
- Object
- Logging::Layout
- MJ::Logging::BasicLayout
- Includes:
- ANSI::Code
- Defined in:
- lib/mj/logging.rb
Overview
Basic Layout for the logging framework.
Will prefix message according to the following list:
WARNING => 'warning: '
ERROR => 'error: '
REST => ''
Instance Method Summary collapse
Instance Method Details
#format(event) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mj/logging.rb', line 20 def format( event ) obj = format_obj(event.data) return case event.level when ::Logging::level_num(:ERROR) red { sprintf("error: %s\n", obj) } when ::Logging::level_num((:WARN)) yellow { sprintf("warning: %s\n", obj) } else if obj.start_with?( '###') blue { obj + "\n" } else obj + "\n" end end end |