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.



65
66
67
68
# File 'lib/lorekeeper/fast_logger.rb', line 65

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

Instance Method Details

#write(message) ⇒ Object



70
71
72
73
74
75
# File 'lib/lorekeeper/fast_logger.rb', line 70

def write(message)
  return unless @iodevice
  @iomutex.synchronize do
    @iodevice.write(message)
  end
end