|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Keywords: ecl streams
Tutorial Level: INTERMEDIATE
LogStream is a convenient, fast means to logging from multiple threads with multiple customisable modes. They can also optionally automatically insert header and timestamp information.
The LogStream class is now mostly irrelevant if you are using ros logging, though they are sometimes a useful low overhead alternative (don't need the sometimes difficult to compile apache libraries) for logging, specially when cross compiling.
Multiple modes are most conveniently utilised via customised enums. For example:
Note that this is an advantage over alot of other loggers in that it gives you the freedom to define your own error logging levels. Each mode can then be associated inside the log stream with its own customised header.
This process can be repeated from multiple threads each with its own instance of the log stream attached to the single file. Using the log stream is then done via the macros LOG and FLUSH
By default this will automatically add header and timestamp information. You can manually disable these if you prefer.