|
| Logger (const Policy &policy, const std::string &directory, const std::string &tmpl) |
| Constructor. More...
|
|
| ~Logger () |
| Destructor. More...
|
|
void | setup (const Policy &policy, const std::string &directory, const std::string &tmpl) |
| Setup the constructor configuration. More...
|
|
Meta & | meta () noexcept |
| Access the log's metadata. More...
|
|
const Meta & | meta () const noexcept |
| Access the log's metadata (const) More...
|
|
void | start (const std::string &ctl_name, double timestep, bool resume=false, double start_t=0.0) |
| Start logging. More...
|
|
void | open (const std::string &file, double timestep, double start_t=0.0) |
| Open a new file for logging. More...
|
|
void | log () |
| Log controller's data. More...
|
|
template<typename CallbackT , typename SourceT = void, typename std::enable_if< mc_rtc::log::callback_is_serializable< CallbackT >::value, int >::type = 0> |
void | addLogEntry (const std::string &name, const SourceT *source, CallbackT &&get_fn, bool overwrite=false) |
|
template<typename MemberPtrT , MemberPtrT member, typename SourceT , typename std::enable_if< mc_rtc::log::is_serializable_member< MemberPtrT >::value, int >::type = 0> |
void | addLogEntry (const std::string &name, const SourceT *source, bool overwrite=false) |
|
template<typename MethodPtrT , MethodPtrT method, typename SourceT , typename std::enable_if< mc_rtc::log::is_serializable_getter< MethodPtrT >::value, int >::type = 0> |
void | addLogEntry (const std::string &name, const SourceT *source, bool overwrite=false) |
|
template<typename T , typename std::enable_if< mc_rtc::log::callback_is_serializable< T >::value, int >::type = 0> |
void | addLogEntry (const std::string &name, T &&get_fn, bool overwrite=false) |
|
template<typename SourceT , typename CallbackT , typename... Args> |
void | addLogEntries (const SourceT *source, const std::string &name, CallbackT &&get_fn, Args &&... args) |
|
void | addGUIEvent (GUIEvent &&event) |
|
void | removeLogEntry (const std::string &name) |
|
void | removeLogEntries (const void *source) |
|
double | t () const |
|
const std::string & | path () const |
|
void | flush () |
|
size_t | size () const |
|
void | clear (bool record=true) |
|
Logs controller data to disk.
The user can select a desired logging policy that will impact the behaviour of this class.
See mc_rtc::Logger::Policy documentation for details on available policies
template<typename MemberPtrT , MemberPtrT member, typename SourceT , typename std::enable_if< mc_rtc::log::is_serializable_member< MemberPtrT >::value, int >::type = 0>
void mc_rtc::Logger::addLogEntry |
( |
const std::string & |
name, |
|
|
const SourceT * |
source, |
|
|
bool |
overwrite = false |
|
) |
| |
|
inline |
Add a log entry from a source and a compile-time pointer to member
This is slightly more efficient than the source + pointer to member version at the cost of annoying syntax, typically:
logger.addLogEntry<decltype(&Source::member), &Source::member>("name", &source);
- Parameters
-
name | Name of the log entry |
source | Source of the log entry |
overwrite | If true, overwrite the previous entry of the same name (if any), otherwise log and return |
template<typename MethodPtrT , MethodPtrT method, typename SourceT , typename std::enable_if< mc_rtc::log::is_serializable_getter< MethodPtrT >::value, int >::type = 0>
void mc_rtc::Logger::addLogEntry |
( |
const std::string & |
name, |
|
|
const SourceT * |
source, |
|
|
bool |
overwrite = false |
|
) |
| |
|
inline |
Add a log entry from a source and a compile-time pointer to method
This is slightly more efficient than the source + pointer to method version at the cost of annoying syntax, typically:
logger.addLogEntry<decltype(&Source::method), &Source::method>("name", &source);
- Parameters
-
name | Name of the log entry |
source | Source of the log entry |
overwrite | If true, overwrite the previous entry of the same name (if any), otherwise log and return |
template<typename CallbackT , typename SourceT = void, typename std::enable_if< mc_rtc::log::callback_is_serializable< CallbackT >::value, int >::type = 0>
void mc_rtc::Logger::addLogEntry |
( |
const std::string & |
name, |
|
|
const SourceT * |
source, |
|
|
CallbackT && |
get_fn, |
|
|
bool |
overwrite = false |
|
) |
| |
|
inline |
Add a log entry into the log with the provided source
This function only accepts callable objects that returns a l/rvalue to a serializable object.
The log entry can be removed by calling:
The later remove all other log entries from the same source
- Parameters
-
name | Name of the log entry, this should be unique at any given time but the same key can be re-used during the logger's life |
source | Source of the log entry |
get_fn | A function that provides data that should be logged |
overwrite | If true, overwrite the previous entry of the same name (if any), otherwise log and return |
template<typename T , typename std::enable_if< mc_rtc::log::callback_is_serializable< T >::value, int >::type = 0>
void mc_rtc::Logger::addLogEntry |
( |
const std::string & |
name, |
|
|
T && |
get_fn, |
|
|
bool |
overwrite = false |
|
) |
| |
|
inline |
Add a log entry into the log with no source
This function only accepts callable objects that returns a l/rvalue to a serializable object.
The log entry can only be removed by calling removeLogEntry with the same name
- Parameters
-
name | Name of the log entry, this should be unique at any given time but the same key can be re-used during the logger's life |
get_fn | A function that provides data that should be logged |
overwrite | If true, overwrite the previous entry of the same name (if any), otherwise log and return |