RclexTesting.DSL.Logs (RclexTesting (Experimental) v0.12.16)

Copy Markdown View Source

Assert ROS 2 log messages published on /rosout.

expect_log/2 matches the log text with an exact string or regular expression. Use :level, :name, :file, :function, and :line to constrain metadata.

expect_log ~r/connection .* failed/,
  level: :error,
  name: ~r/^robot./,
  file: ~r/navigator.ex$/,
  function: "handle_event",
  line: 42

Summary

Functions

Assert that a ROS 2 log message matching message and optional metadata arrives.

Functions

expect_log(message, opts \\ [])

@spec expect_log(
  String.t() | Regex.t(),
  keyword()
) :: Rclex.Pkgs.RclInterfaces.Msg.Log.t()

Assert that a ROS 2 log message matching message and optional metadata arrives.

message, :name, :file, and :function accept an exact string or a regular expression. :level accepts a ROS numeric level or one of :debug, :info, :warn, :error, or :fatal; :line is an exact integer.

Pass :timeout as an additional option. Log collection starts automatically with each scenario and retains a bounded buffer configured with scenario ..., log_buffer_size: 100.