Sha256: b4052c4f92b82d012ab68012b191820763f4ee3d1f526acab738b7954406b494

Contents?: true

Size: 664 Bytes

Versions: 15

Compression:

Stored size: 664 Bytes

Contents

require 'logger'

module Taperole
  module Helpers
    module Logging
      def initialize(*_args)
        super
        logger.level = logger_level
        logger.formatter = proc do |_severity, _datetime, _progname, msg|
          "#{msg}\n"
        end
      end

      def logger
        Logging.logger
      end

      def self.logger
        @logger ||= Logger.new(STDOUT)
      end

      private

      def logger_level
        if options[:debug]
          Logger::DEBUG
        elsif options[:verbose]
          Logger::INFO
        elsif options[:quiet]
          Logger::ERROR
        else
          Logger::INFO
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
taperole-2.1.1 lib/taperole/helpers/logging.rb
taperole-2.1.0 lib/taperole/helpers/logging.rb
taperole-2.0.7 lib/taperole/helpers/logging.rb
taperole-2.0.6 lib/taperole/helpers/logging.rb
taperole-2.0.5 lib/taperole/helpers/logging.rb
taperole-2.0.4 lib/taperole/helpers/logging.rb
taperole-2.0.3 lib/taperole/helpers/logging.rb
taperole-2.0.2 lib/taperole/helpers/logging.rb
taperole-2.0.1 lib/taperole/helpers/logging.rb
taperole-2.0.0 lib/taperole/helpers/logging.rb
taperole-1.8.2 lib/taperole/helpers/logging.rb
taperole-1.8.1 lib/taperole/helpers/logging.rb
taperole-1.8.0 lib/taperole/helpers/logging.rb
taperole-1.7.1 lib/taperole/helpers/logging.rb
taperole-1.7.0 lib/taperole/helpers/logging.rb