Class: Retag::Logger
- Inherits:
-
Logger
- Object
- Logger
- Retag::Logger
- Defined in:
- lib/retag/logger.rb
Instance Method Summary collapse
- #format_message(severity, datetime, progname, msg) ⇒ Object
- #shift(spaces: 2, &block) ⇒ Object
- #unshift(spaces: 2) ⇒ Object
- #with_shift(spaces: 2) ⇒ Object
Instance Method Details
#format_message(severity, datetime, progname, msg) ⇒ Object
28 29 30 |
# File 'lib/retag/logger.rb', line 28 def (severity, datetime, progname, msg) super(severity, datetime, progname, "#{' ' * (@shift || 0)}#{msg}") end |
#shift(spaces: 2, &block) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/retag/logger.rb', line 7 def shift(spaces: 2, &block) if block_given? with_shift(spaces: spaces, &block) else @shift ||= 0 @shift += spaces end end |
#unshift(spaces: 2) ⇒ Object
16 17 18 19 |
# File 'lib/retag/logger.rb', line 16 def unshift(spaces: 2) @shift ||= 0 @shift -= spaces end |
#with_shift(spaces: 2) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/retag/logger.rb', line 21 def with_shift(spaces: 2) shift(spaces: spaces) yield ensure unshift(spaces: spaces) end |