Sha256: 75bb66ef668bee72e01d996919902a467c2649349ba43727c2fdf4318baf6a2f

Contents?: true

Size: 632 Bytes

Versions: 26

Compression:

Stored size: 632 Bytes

Contents

# encoding: UTF-8

module Tetra
  # configures logging for this application
  class Logger
    include Singleton
    extend Forwardable

    def_delegators :@logger, :debug, :info, :warn, :error, :fatal, :level=

    def initialize
      @logger = ::Logger.new(STDERR)
      @logger.datetime_format = "%Y-%m-%d %H:%M "
      @logger.level = ::Logger::ERROR
      @logger.formatter = proc do |severity, _datetime, _progname, msg|
        "#{severity.chars.first}: #{msg}\n"
      end
    end
  end

  # convenience methods
  module Logging
    # convenience instance method
    def log
      Tetra::Logger.instance
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
tetra-2.0.6 lib/tetra/logger.rb
tetra-2.0.5 lib/tetra/logger.rb
tetra-2.0.4 lib/tetra/logger.rb
tetra-2.0.3 lib/tetra/logger.rb
tetra-2.0.2 lib/tetra/logger.rb
tetra-2.0.1 lib/tetra/logger.rb
tetra-2.0.0 lib/tetra/logger.rb
tetra-1.2.2 lib/tetra/logger.rb
tetra-1.2.1 lib/tetra/logger.rb
tetra-1.2.0 lib/tetra/logger.rb
tetra-1.1.0 lib/tetra/logger.rb
tetra-1.0.0 lib/tetra/logger.rb
tetra-0.54.0 lib/tetra/logger.rb
tetra-0.53.0 lib/tetra/logger.rb
tetra-0.52.0 lib/tetra/logger.rb
tetra-0.51.0 lib/tetra/logger.rb
tetra-0.50.0 lib/tetra/logger.rb
tetra-0.49.0 lib/tetra/logger.rb
tetra-0.48.0 lib/tetra/logger.rb
tetra-0.46.0 lib/tetra/logger.rb