Method: Roby::Application#log_current_file

Defined in:
lib/roby/app.rb

#log_current_fileObject

The path to the current log file



1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
# File 'lib/roby/app.rb', line 1714

def log_current_file
    log_current_dir = self.log_current_dir
     = 
    if .empty?
        raise NoCurrentLog,
              "#{log_current_dir} is not a valid Roby log dir, "\
              "it does not have an info.yml metadata file"
    elsif !(robot_name = .map { |h| h["robot_name"] }.compact.last)
        raise NoCurrentLog,
              "#{log_current_dir}'s metadata does not specify the robot name"
    end

    full_path = File.join(log_current_dir, "#{robot_name}-events.log")
    unless File.file?(full_path)
        raise NoCurrentLog,
              "inferred log file #{full_path} for #{log_current_dir}, "\
              "but that file does not exist"
    end

    full_path
end