Class: Lorekeeper::FastLogger::LogDevice

Inherits:
Object
  • Object
show all
Defined in:
lib/lorekeeper/fast_logger.rb

Overview

Very fast class to write to a log file.

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ LogDevice

Returns a new instance of LogDevice.



91
92
93
94
# File 'lib/lorekeeper/fast_logger.rb', line 91

def initialize(file)
  @iodevice = to_iodevice(file)
  @iomutex = LogDeviceMutex.new
end

Instance Method Details

#write(message) ⇒ Object



96
97
98
99
100
101
102
# File 'lib/lorekeeper/fast_logger.rb', line 96

def write(message)
  return unless @iodevice

  @iomutex.synchronize do
    @iodevice.write(message)
  end
end