Method: OpenC3::TextLogWriter#write

Defined in:
lib/openc3/logs/text_log_writer.rb

#write(time_nsec_since_epoch, data, redis_topic, redis_offset) ⇒ Object

Write to the log file.

If no log file currently exists in the filesystem, a new file will be created.

Parameters:

  • time_nsec_since_epoch (Integer)

    64 bit integer nsecs since EPOCH

  • data (String)

    String of data

  • redis_offset (Integer)

    The offset of this packet in its Redis stream



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/openc3/logs/text_log_writer.rb', line 44

def write(time_nsec_since_epoch, data, redis_topic, redis_offset)
  return if !@logging_enabled

  @mutex.synchronize do
    prepare_write(time_nsec_since_epoch, data.length, redis_topic, redis_offset)
    write_entry(time_nsec_since_epoch, data) if @file
  end
rescue => e
  Logger.instance.error "Error writing #{@filename} : #{e.formatted}"
  OpenC3.handle_critical_exception(e)
end