Sha256: 7bd2f474498504b5076a90653c5dcfd9b707cb803d6e04f0964f854ff832b210

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

require "logger"

module Kanal
  module Core
    module Logging
      # Logger instance will be saved inside class itself for future calls
      @logger_instance

      # Mixing in Logger in some class adds possibility to use logger instance method
      def logger
        @logger_instance ||= Logging.create_logger self.class.name
      end

      class << self
        def create_logger(class_name)
          logger = Logger.new STDOUT
          logger.progname = class_name.rpartition(':').last
          logger.datetime_format = "%d-%m-%Y %H:%M:%S"
          logger
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kanal-0.4.1 lib/kanal/core/logger/logging.rb
kanal-0.4.0 lib/kanal/core/logger/logging.rb