Sha256: 488dc4107c119c51815e05452fc7ef6a3f9a68f2fdede15bb92e3a703707226e
Contents?: true
Size: 908 Bytes
Versions: 4
Compression:
Stored size: 908 Bytes
Contents
require 'cliutils/pretty_io' module CLIUtils # CLIMessenger Module # Outputs coordinated messages to a variety of targets. module Messenging include PrettyIO # Hook that triggers when this module is included. # @param [Object] k The includer object # @return [void] def self.included(k) k.extend(self) end # Returns a default instance of LoggerDelegator that # delegates to STDOUT only. # @return [LoggerDelegator] def default_instance stdout_logger = Logger.new(STDOUT) stdout_logger.formatter = proc do |severity, datetime, progname, msg| send(severity.downcase, msg) end LoggerDelegator.new(STDOUT: stdout_logger) end # Singleton method to return (or initialize, if needed) # a LoggerDelegator. # @return [LoggerDelegator] def messenger @@messenger ||= default_instance end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cliutils-1.2.7 | lib/cliutils/messenging.rb |
cliutils-1.2.6 | lib/cliutils/messenging.rb |
cliutils-1.2.5 | lib/cliutils/messenging.rb |
cliutils-1.2.4 | lib/cliutils/messenging.rb |