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.



95
96
97
98
# File 'lib/lorekeeper/fast_logger.rb', line 95

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

Instance Method Details

#write(message) ⇒ Object



100
101
102
103
104
105
106
# File 'lib/lorekeeper/fast_logger.rb', line 100

def write(message)
  return unless @iodevice

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