Class Log
Defined in File Log.hpp
Nested Relationships
Nested Types
Class Documentation
-
class Log
Public Types
-
enum class Tier : uint32_t
A computer-friendly ranking of how serious the log entry is.
Values:
-
enumerator Uninitialized
This is a sentinel value that should not generally be used.
-
enumerator Info
An expected occurrence took place.
-
enumerator Warning
An unexpected, problematic occurrence took place, but it can be recovered from. Human attention is recommended but not necessary.
-
enumerator Error
A problem happened, and humans should be alerted.
-
enumerator Uninitialized
Public Functions
-
Log(std::function<rmf_traffic::Time()> clock = nullptr)
Construct a log.
- Parameters:
clock – [in] Specify a clock for this log to use. If nullptr is given, then std::chrono::system_clock::now() will be used.
-
void info(std::string text)
Add an informational entry to the log.
-
void warn(std::string text)
Add a warning to the log.
-
void error(std::string text)
Add an error to the log.
-
class Entry
A single entry within the log.
-
class Reader
A Reader that can iterate through the Views of Logs. The Reader will keep track of which Entries have already been viewed, so every Entry read by a single Reader instance is unique.
Public Functions
-
Iterable read(const View &view)
Create an object that can iterate through the entries of a View. Any entries that have been read by this Reader in the past will be skipped. This can be used in a range-based for loop, e.g.:
for (const auto& entry : reader.read(view)) { std::cout << entry.text() << std::endl; }
-
class Iterable
-
Public Functions
-
class iterator
Public Functions
-
iterator &operator++()
Pre-increment operator: ++it
Note
This is more efficient than the post-increment operator.
Warning
It is undefined behavior to perform this operation on an iterator that is equal to Log::Reader::Iterable::end().
- Returns:
a reference to the iterator itself
-
iterator operator++(int)
Post-increment operator: it++
Warning
It is undefined behavior to perform this operation on an iterator that is equal to Log::Reader::Iterable::end().
- Returns:
a copy of the iterator before it was incremented.
-
iterator &operator++()
-
class iterator
-
Iterable read(const View &view)
-
enum class Tier : uint32_t