The Log class provides the base class for all GRT logging functionality.
More...
#include <Log.h>
|
| Log (const std::string &key="") |
| defines the log default constructor More...
|
|
| Log (const Log &rhs) |
| defines the log copy constructor More...
|
|
Log & | operator= (const Log &rhs) |
| defines the log equals operator More...
|
|
template<class T > |
const Log & | operator<< (const T &val) const |
| defines an operator<< to write a value to std::endl, this updates the message
|
|
const Log & | operator<< (const StandardEndLine manip) const |
| defines an operator<< to take in std::endl, this ends a message and triggers the mesaage callback
|
|
virtual bool | getInstanceLoggingEnabled () const |
| returns true if logging is enabled for this specific instance More...
|
|
virtual std::string | getKey () const |
| returns the key that gets written at the start of each message More...
|
|
virtual std::string | getLastMessage () const |
| returns the last message written by the log More...
|
|
virtual bool | setKey (const std::string &key) |
| sets the key that gets written at the start of each message, this will be written in the format 'key message'. The key can be empty. More...
|
|
virtual bool | getInstanceLoggingEnabled () |
| returns if logging is enabled for this specific instance More...
|
|
virtual bool | setInstanceLoggingEnabled (const bool loggingEnabled) |
| sets if logging is enabled for this specific instance More...
|
|
| GRT_DEPRECATED_MSG ("setProceedingText is deprecated, use setKey instead", void setProceedingText(std::string proceedingText)) |
|
| GRT_DEPRECATED_MSG ("getProceedingText is deprecated, use getKey instead", std::string getProceedingText() const ) |
|
| GRT_DEPRECATED_MSG ("setEnableInstanceLogging is deprecated, use setInstanceLoggingEnabled instead", bool setEnableInstanceLogging(const bool loggingEnabled)) |
|
|
static bool | getLoggingEnabled () |
| returns true if logging is enabled for this class, this supersedes the specific instance logging More...
|
|
static bool | setLoggingEnabled (const bool enabled) |
| sets if logging is enabled for this class, this supersedes the specific instance logging More...
|
|
|
virtual void | triggerCallback (const std::string &message) const |
| This callback can be used to propagate messages to other interfaces (e.g., a GUI built on top of the GRT). It gets triggered anytime a message is ended (with std::endl), the message will contain the full message + the log key. To use this, inherit from the log base class and overwrite the contents of this virtual function. More...
|
|
|
std::string | key |
| The key that will be written at the start of each log.
|
|
std::string | lastMessage |
| The last message written.
|
|
bool | writeKey |
| If true, then the key will be written at the start of each log message.
|
|
bool | instanceLoggingEnabled |
| If true, then this instance should log messages.
|
|
bool * | loggingEnabledPtr |
| This is a hack that enables variables to be updated inside const methods.
|
|
bool * | writeKeyPtr |
| This is a hack that enables variables to be updated inside const methods.
|
|
std::string * | lastMessagePtr |
| This is a hack that enables variables to be updated inside const methods.
|
|
The Log class provides the base class for all GRT logging functionality.
Definition at line 37 of file Log.h.
Log::Log |
( |
const std::string & |
key = "" | ) |
|
|
inline |
defines the log default constructor
- Parameters
-
key | the key that will written to the start of every log message, can be empty |
Definition at line 46 of file Log.h.
Log::Log |
( |
const Log & |
rhs | ) |
|
|
inline |
defines the log copy constructor
- Parameters
-
rhs | the rhs log instance that will be copied to this instance |
Definition at line 59 of file Log.h.
virtual bool Log::getInstanceLoggingEnabled |
( |
| ) |
const |
|
inlinevirtual |
returns true if logging is enabled for this specific instance
- Returns
- returns true if logging is enabled for this specific instance, false otherwise
Definition at line 141 of file Log.h.
virtual bool Log::getInstanceLoggingEnabled |
( |
| ) |
|
|
inlinevirtual |
returns if logging is enabled for this specific instance
- Returns
- returns true if logging is enabled for this specific instance, false otherwise
Definition at line 184 of file Log.h.
virtual std::string Log::getKey |
( |
| ) |
const |
|
inlinevirtual |
returns the key that gets written at the start of each message
- Returns
- returns the key used to tag each message
Definition at line 149 of file Log.h.
virtual std::string Log::getLastMessage |
( |
| ) |
const |
|
inlinevirtual |
returns the last message written by the log
- Returns
- returns a string containing the last message written by the log
Definition at line 157 of file Log.h.
static bool Log::getLoggingEnabled |
( |
| ) |
|
|
inlinestatic |
returns true if logging is enabled for this class, this supersedes the specific instance logging
- Returns
- returns true if logging is enabled for this class, false otherwise
Definition at line 176 of file Log.h.
Log& Log::operator= |
( |
const Log & |
rhs | ) |
|
|
inline |
defines the log equals operator
- Parameters
-
rhs | the rhs log instance that will be copied to this instance |
- Returns
- returns a reference to this instance
Definition at line 76 of file Log.h.
virtual bool Log::setInstanceLoggingEnabled |
( |
const bool |
loggingEnabled | ) |
|
|
inlinevirtual |
sets if logging is enabled for this specific instance
- Returns
- returns true if the parameter was updated successfully, false otherwise
Definition at line 201 of file Log.h.
virtual bool Log::setKey |
( |
const std::string & |
key | ) |
|
|
inlinevirtual |
sets the key that gets written at the start of each message, this will be written in the format 'key message'. The key can be empty.
- Parameters
-
key | the new key, this can be empty |
- Returns
- returns true if the key was updated
Definition at line 166 of file Log.h.
static bool Log::setLoggingEnabled |
( |
const bool |
enabled | ) |
|
|
inlinestatic |
sets if logging is enabled for this class, this supersedes the specific instance logging
- Returns
- returns true if the parameter was updated successfully, false otherwise
Definition at line 192 of file Log.h.
virtual void Log::triggerCallback |
( |
const std::string & |
message | ) |
const |
|
inlineprotectedvirtual |
This callback can be used to propagate messages to other interfaces (e.g., a GUI built on top of the GRT). It gets triggered anytime a message is ended (with std::endl), the message will contain the full message + the log key. To use this, inherit from the log base class and overwrite the contents of this virtual function.
- Parameters
-
message | the message from the latest log |
Reimplemented in DebugLog, InfoLog, TestingLog, ErrorLog, and TrainingLog.
Definition at line 217 of file Log.h.
GRT_BEGIN_NAMESPACE bool Log::baseLoggingEnabled = true |
|
staticprotected |
This controls logging across all Log instances, as opposed to a single instance.
Global logging for base class.
Definition at line 228 of file Log.h.
The documentation for this class was generated from the following files: