Method: OpenC3::MessageLog#write

Defined in:
lib/openc3/utilities/message_log.rb

#write(message, flush = false) ⇒ Object

Ensures the log file is opened and ready to write. It then writes the message to the log and flushes it to force the write.

Parameters:

  • message (String)

    Message to write to the log



54
55
56
57
58
59
60
61
62
63
# File 'lib/openc3/utilities/message_log.rb', line 54

def write(message, flush = false)
  @mutex.synchronize do
    if @file.nil? or @file.closed? or (not File.exist?(@filename))
      start(false)
    end

    @file.write(message)
    @file.flush if flush
  end
end