Class: Low::ScopedLogger
- Inherits:
-
Logger
- Object
- Logger
- Low::ScopedLogger
- Defined in:
- lib/low/scoped_logger.rb
Overview
‘Low::ScopedLogger` is a tiny extension to `Logger`. It allows `scope` to be specified, making it easy to grep any messages generated by a particular instance.
Instance Attribute Summary collapse
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
Instance Attribute Details
#scope ⇒ Object
Returns the value of attribute scope.
8 9 10 |
# File 'lib/low/scoped_logger.rb', line 8 def scope @scope end |
Instance Method Details
#add(severity, message = nil, progname = nil, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/low/scoped_logger.rb', line 10 def add(severity, = nil, progname = nil, &block) if .nil? if block_given? = yield else = progname progname = @progname end end = = "[#{@scope}] #{}" if @scope super severity, , progname, &block end |