Class: Egalite::DebugLogger

Inherits:
Object show all
Defined in:
lib/egalite.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DebugLogger

Returns a new instance of DebugLogger.



66
67
68
# File 'lib/egalite.rb', line 66

def initialize(path)
  @path = path
end

Instance Method Details

#puts(s) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/egalite.rb', line 69

def puts(s)
  open(@path, "a") { |f|
    begin
      f.flock(File::LOCK_EX)
      f.puts s
      f.flush
    ensure
      f.flock(File::LOCK_UN)
    end
  }
end