Sha256: 695e6aa607fa29661837c0f3a6198f0aa5258af669dfd89153bed6a6b5d6ccea

Contents?: true

Size: 643 Bytes

Versions: 4

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true
module Sapience
  module Loggable
    def self.included(base)
      base.send(:extend, Extensions)
    end

    # Returns [Sapience::Logger] instance level logger
    def logger
      @logger ||= self.class.logger
    end

    # Replace instance level logger
    def logger=(logger)
      @logger = logger
    end

    module Extensions
      # Returns [Sapience::Logger] class level logger
      def logger
        @logger ||= Sapience[self]
      end

      # Replace instance class level logger
      def logger=(logger)
        @logger = logger
      end
    end
  end
  # rubocop:enable TrivialAccessors
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sapience-2.5.4 lib/sapience/loggable.rb
sapience-2.5.3 lib/sapience/loggable.rb
sapience-2.5.2 lib/sapience/loggable.rb
sapience-2.5.0 lib/sapience/loggable.rb