Class: Logger
- Inherits:
-
Object
- Object
- Logger
- Defined in:
- lib/soc_maker.rb
Overview
This little extension allows to have a custom log level: PROC for processing. Found on stackoverflow.com/questions/2281490/how-to-add-a-custom-log-level-to-logger-in-ruby
Class Method Summary collapse
-
.custom_level(tag) ⇒ Object
Method to add a custom log level.
Class Method Details
.custom_level(tag) ⇒ Object
Method to add a custom log level
65 66 67 68 69 70 71 72 |
# File 'lib/soc_maker.rb', line 65 def self.custom_level(tag) SEV_LABEL << tag idx = SEV_LABEL.size - 1 define_method(tag.downcase.gsub(/\W+/, '_').to_sym) do |progname, &block| add(idx, nil, progname, &block) end end |