Class: Algolia::LoggerHelper
- Inherits:
-
Object
- Object
- Algolia::LoggerHelper
- Defined in:
- lib/algolia/logger_helper.rb
Class Method Summary collapse
Class Method Details
.create(debug_file = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/algolia/logger_helper.rb', line 7 def self.create(debug_file = nil) file = debug_file if file.nil? && ENV["ALGOLIA_DEBUG"] begin file = File.new("debug.log", "a+") rescue Errno::EACCES, Errno::ENOENT => e puts("Failed to open debug.log: #{e.}. Falling back to $stderr.") end end instance = ::Logger.new(file || $stderr) instance.progname = "algolia" instance end |