Module: ShellShock::Logger

Included in:
Context
Defined in:
lib/shell_shock/logger.rb

Instance Method Summary collapse

Instance Method Details

#log(message = nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/shell_shock/logger.rb', line 5

def log(message = nil)
  return unless ENV["LOG_PATH"]

  File.open(ENV.fetch("LOG_PATH", nil), "a") do |file|
    file.puts message if message
    file.puts yield if block_given?
  end
end