Sha256: f4242a944c03307f022f68f2a6074e0f09bc961f93f0a6edc1ae947a0bbe5c9d

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

# encoding: UTF-8

module Gjp
  # 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
      Gjp::Logger.instance
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gjp-0.39.0 lib/gjp/logger.rb