Sha256: f6519088a711103a7d520a4e92a7446d3322b90b129c4e342c4a175066242c24

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

module Toy
  module Logger
    extend ActiveSupport::Concern

    module ClassMethods
      def logger
        Toy.logger
      end

      def log_operation(operation, model, adapter, key, value=nil)
        if logger.debug?
          logger.debug("ToyStore #{operation.to_s.upcase} #{model} :#{adapter.name} #{key.inspect}")
          logger.debug("  #{value.inspect}") unless value.nil?
        end
      end
    end

    module InstanceMethods
      def logger
        Toy.logger
      end

      def log_operation(*args)
        self.class.log_operation(*args)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
toystore-0.8.0 lib/toy/logger.rb
toystore-0.7.0 lib/toy/logger.rb