Class: Dotenv::ReplayLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/dotenv/replay_logger.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initializeReplayLogger

Returns a new instance of ReplayLogger.



4
5
6
# File 'lib/dotenv/replay_logger.rb', line 4

def initialize
  @logs = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



8
9
10
# File 'lib/dotenv/replay_logger.rb', line 8

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

Instance Method Details

#replay(logger) ⇒ Object



16
17
18
# File 'lib/dotenv/replay_logger.rb', line 16

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

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/dotenv/replay_logger.rb', line 12

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