Class: Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/cliutils/ext/Logger+Extensions.rb

Overview

Logger Class
======================================================

Class Method Summary (collapse)

Class Method Details

+ (Object) custom_level(tag)


custom_level method

Creates a custom Logger level based on the passed
tag.
@param tag The Logger level to create
@return Void
----------------------------------------------------


15
16
17
18
19
20
21
22
# File 'lib/cliutils/ext/Logger+Extensions.rb', line 15

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