Class: Console::Compatible::Logger
- Inherits:
-
Logger
- Object
- Logger
- Console::Compatible::Logger
- Defined in:
- lib/console/compatible/logger.rb
Overview
A compatible interface for Logger which can be used with Console.
Defined Under Namespace
Classes: LogDevice
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil) ⇒ Object
- #format_severity(value) ⇒ Object
-
#initialize(subject, output = Console) ⇒ Logger
constructor
A new instance of Logger.
Constructor Details
Instance Method Details
#add(severity, message = nil, progname = nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/console/compatible/logger.rb', line 40 def add(severity, = nil, progname = nil) severity ||= UNKNOWN if @logdev.nil? or severity < level return true end if progname.nil? progname = @progname end if .nil? if block_given? = yield else = progname progname = @progname end end @logdev.call( progname, , severity: format_severity(severity) ) return true end |
#format_severity(value) ⇒ Object
68 69 70 |
# File 'lib/console/compatible/logger.rb', line 68 def format_severity(value) super.downcase.to_sym end |