Sha256: 442a109320890c4d5db2c2eb9e11b0053ee7d484c240d93a7a4ff576bca28f6e
Contents?: true
Size: 489 Bytes
Versions: 11
Compression:
Stored size: 489 Bytes
Contents
require 'logger' # Logger Class extensions class Logger # Creates a custom Logger level based on the passed # tag. # @param [String] tag The Logger level to create # @return [void] 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 custom_level('PROMPT') custom_level('SECTION') custom_level('SUCCESS') end
Version data entries
11 entries across 11 versions & 1 rubygems