Sha256: 87434ff1aee9999063c932984ce16144d808806fcf0d3e7cfe30732ea92efa8d
Contents?: true
Size: 731 Bytes
Versions: 3
Compression:
Stored size: 731 Bytes
Contents
require 'logger' # ====================================================== # Logger Class # ====================================================== class Logger # ---------------------------------------------------- # custom_level method # # Creates a custom Logger level based on the passed # tag. # @param 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cliutils-1.0.2 | lib/cliutils/ext/Logger+Extensions.rb |
cliutils-1.0.1 | lib/cliutils/ext/Logger+Extensions.rb |
cliutils-1.0.0 | lib/cliutils/ext/Logger+Extensions.rb |