class Dotenv::ReplayLogger

A logger that can be used before the apps real logger is initialized.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/dotenv/replay_logger.rb, line 4
def initialize
  super(nil) # Doesn't matter what this is, it won't be used.
  @logs = []
end

Public Instance Methods

add(*args, &block) click to toggle source

Override the add method to store logs so we can replay them to a real logger later.

# File lib/dotenv/replay_logger.rb, line 10
def add(*args, &block)
  @logs.push([args, block])
end
replay(logger) click to toggle source

Replay the store logs to a real logger.

# File lib/dotenv/replay_logger.rb, line 15
def replay(logger)
  @logs.each { |args, block| logger.add(*args, &block) }
  @logs.clear
end