Method: OpenC3::MessageLog#start

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

#start(take_mutex = true) ⇒ Object

Creates a new message log and sets the filename



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/openc3/utilities/message_log.rb', line 83

def start(take_mutex = true)
  @mutex.lock if take_mutex
  # Prevent starting files too fast
  sleep(0.1) until !File.exist?(File.join(@log_dir, File.build_timestamped_filename(@tags)))
  stop(false)
  timed_filename = File.build_timestamped_filename(@tags)
  @start_day = timed_filename[0..9].gsub("_", "") # YYYYMMDD
  @filename = File.join(@log_dir, timed_filename)
  @file = File.open(@filename, 'a')
  @mutex.unlock if take_mutex
end