Public Member Functions | Protected Member Functions | Private Attributes | List of all members
cras::WrapperLogHelper Class Reference

#include <log_utils.h>

Inheritance diagram for cras::WrapperLogHelper:
Inheritance graph
[legend]

Public Member Functions

void checkLogLocationEnabled (::ros::console::LogLocation *loc) const override
 Check whether the log location is enabled. More...
 
const void * getId () const override
 Return a unique identifier of this logger. These IDs are used for determining which logger has already logged something. More...
 
::ros::Time getTimeNow () const override
 
void logString (void *logger, ::ros::console::Level level, const ::std::string &str, const char *file, uint32_t line, const char *function) const override
 Write the given string to the log. More...
 
void setLogLocationLevel (::ros::console::LogLocation *loc, ::ros::console::Level level) const override
 Set level of a log location. This is only called when global logging level changes. More...
 
 WrapperLogHelper (const ::cras::LogHelper *wrapped)
 
- Public Member Functions inherited from cras::LogHelper
virtual ::ros::Time getTimeNow () const
 Get current time (used for throttling messages). By default, ROS time is returned, with fallback to wall time if ROS time is not initialized. More...
 
void initialize () const
 Initialize the logger. This function does what it needs and then calls initializeImpl(). More...
 
void initializeLogLocation (::ros::console::LogLocation *loc, const std::string &name, ::ros::console::Level level) const
 Initialize the given log location with proper data for later use. This is the function called from macros. This function checks whether log level is within bounds, corrects it if needed, calls initializeLogLocaionImpl(), and, if the passed log level was wrong, logs an additional error (after the log location has been initialized by the impl function). More...
 
void log (::ros::console::Level level, ::std::string format,...) const
 Log a message using the given log severity. More...
 
void log (::ros::console::Level level, const char *format,...) const
 Log a message using the given log severity. More...
 
 LogHelper ()
 
 LogHelper (const LogHelper &)=delete
 
 LogHelper (LogHelper &&)=delete
 
LogHelperoperator= (const LogHelper &)=delete
 
LogHelperoperator= (LogHelper &&)=delete
 
void print (::ros::console::FilterBase *filter, void *logger, ::ros::console::Level level, const ::std::string &str, const char *file, int line, const char *function) const
 Print function used by the macros. It basically just relays its work to logString(). More...
 
void print (::ros::console::FilterBase *filter, void *logger, ::ros::console::Level level, const ::std::stringstream &ss, const char *file, int line, const char *function) const
 Print function used by the macros. It basically just relays its work to logString(). More...
 
void void print (::ros::console::FilterBase *filter, void *logger, ::ros::console::Level level, const char *file, int line, const char *function, ::std::string fmt,...) const
 Print function used by the macros. It basically just relays its work to logString(). More...
 
void print (::ros::console::FilterBase *filter, void *logger, ::ros::console::Level level, const char *file, int line, const char *function, const char *fmt,...) const ROSCONSOLE_PRINTF_ATTRIBUTE(8
 Print function used by the macros. It basically just relays its work to logString(). More...
 
void print (::ros::console::Level level, const ::std::string &text) const
 Log a message using the given log severity. More...
 
void setGlobalLogger () const
 
virtual ~LogHelper ()=default
 

Protected Member Functions

void initializeImpl () const override
 Initialize the logger. It is not needed to check initialized as this function is only called when it was false. More...
 
void initializeLogLocationImpl (::ros::console::LogLocation *loc, const ::std::string &name, ::ros::console::Level level) const override
 
- Protected Member Functions inherited from cras::LogHelper
virtual void initializeLogLocationImpl (::ros::console::LogLocation *loc, const std::string &name, ::ros::console::Level level) const =0
 Initialize the given log location with proper data for later use. This function is only called if the log location was not already initialized. More...
 

Private Attributes

const ::cras::LogHelperwrapped
 

Additional Inherited Members

- Public Types inherited from cras::LogHelper
typedef ::std::shared_ptr< const ::cras::LogHelperConstPtr
 Const pointer to LogHelper. More...
 
typedef ::std::shared_ptr<::cras::LogHelperPtr
 Pointer to LogHelper. More...
 
- Public Attributes inherited from cras::LogHelper
bool initialized {false}
 Whether initialize() has been called at least once. Subclasses are required to handle this invariant. More...
 

Detailed Description

Definition at line 255 of file log_utils.h.

Constructor & Destructor Documentation

◆ WrapperLogHelper()

cras::WrapperLogHelper::WrapperLogHelper ( const ::cras::LogHelper wrapped)
explicit

Member Function Documentation

◆ checkLogLocationEnabled()

void cras::WrapperLogHelper::checkLogLocationEnabled ( ::ros::console::LogLocation loc) const
overridevirtual

Check whether the log location is enabled.

Parameters
[in]locThe location to check.

Reimplemented from cras::LogHelper.

◆ getId()

const void* cras::WrapperLogHelper::getId ( ) const
overridevirtual

Return a unique identifier of this logger. These IDs are used for determining which logger has already logged something.

Returns
An ID.

Reimplemented from cras::LogHelper.

◆ getTimeNow()

::ros::Time cras::WrapperLogHelper::getTimeNow ( ) const
override

◆ initializeImpl()

void cras::WrapperLogHelper::initializeImpl ( ) const
overrideprotectedvirtual

Initialize the logger. It is not needed to check initialized as this function is only called when it was false.

Implements cras::LogHelper.

◆ initializeLogLocationImpl()

void cras::WrapperLogHelper::initializeLogLocationImpl ( ::ros::console::LogLocation loc,
const ::std::string &  name,
::ros::console::Level  level 
) const
overrideprotected

◆ logString()

void cras::WrapperLogHelper::logString ( void *  logger,
::ros::console::Level  level,
const ::std::string &  str,
const char *  file,
uint32_t  line,
const char *  function 
) const
overridevirtual

Write the given string to the log.

Parameters
[in]loggerPrivate logger data read from the relevant log location (set by initializeLogLocation()).
[in]levelLevel of the logged message.
[in]strLogged message.
[in]fileFile at which the logging macro has been called.
[in]lineLine on which the logging macro has been called.
[in]functionName of function from which the logging macro has been called.

Implements cras::LogHelper.

◆ setLogLocationLevel()

void cras::WrapperLogHelper::setLogLocationLevel ( ::ros::console::LogLocation loc,
::ros::console::Level  level 
) const
overridevirtual

Set level of a log location. This is only called when global logging level changes.

Parameters
[in,out]locThe location to update.
[in]levelThe new level.

Reimplemented from cras::LogHelper.

Member Data Documentation

◆ wrapped

const ::cras::LogHelper* cras::WrapperLogHelper::wrapped
private

Definition at line 279 of file log_utils.h.


The documentation for this class was generated from the following file:


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sun Jan 14 2024 03:48:14