lib/shell_shock/logger.rb in shell_shock-0.0.5 vs lib/shell_shock/logger.rb in shell_shock-0.0.6
- old
+ new
@@ -1,11 +1,14 @@
+# frozen_string_literal: true
+
module ShellShock
- module Logger
- def log message=nil
- return unless ENV['LOG_PATH']
- File.open(ENV['LOG_PATH'], 'a') do |file|
+ module Logger
+ 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
end
-end
\ No newline at end of file
+end