Sha256: cfd06df03e2804b094e5aca9da21759750313e5a264bca67ca11c239acda3108

Contents?: true

Size: 535 Bytes

Versions: 4

Compression:

Stored size: 535 Bytes

Contents

module Dotenv
  # A logger that can be used before the apps real logger is initialized.
  class ReplayLogger
    def initialize
      @logs = []
    end

    def method_missing(name, *args, &block)
      @logs.push([name, args, block])
    end

    def respond_to_missing?(name, include_private = false)
      (include_private ? Logger.instance_methods : Logger.public_instance_methods).include?(name) || super
    end

    def replay(logger)
      @logs.each { |name, args, block| logger.send(name, *args, &block) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dotenv-3.0.2 lib/dotenv/replay_logger.rb
dotenv-3.0.1 lib/dotenv/replay_logger.rb
dotenv-3.0.0 lib/dotenv/replay_logger.rb
dotenv-3.0.0.beta lib/dotenv/replay_logger.rb