55 typedef ::std::shared_ptr<::cras::LogHelper>
Ptr;
56 typedef ::std::shared_ptr<const ::cras::LogHelper>
ConstPtr;
130 uint32_t line,
const char*
function)
const = 0;
144 virtual const void*
getId()
const;
156 const char* file,
int line,
const char*
function, ::std::string fmt, ...)
const;
162 const ::std::stringstream& ss,
const char* file,
int line,
const char*
function)
const;
168 const char* file,
int line,
const char*
function)
const;
170 [[deprecated(
"This function will be removed in a future release.")]]
179 [[deprecated(
"Use CRAS_* logging macros instead.")]]
188 [[deprecated(
"Use CRAS_* logging macros instead.")]]
196 [[deprecated(
"Use CRAS_* logging macros instead.")]]
216 const char*
function)
const override;
255 class [[deprecated("This wrapper should only be used to provide backward compatibility.")]]
266 const char*
function)
const override;
270 const void*
getId()
const override;
279 const ::cras::LogHelper* wrapped;
297 [[deprecated(
"This function will be removed in a future release.")]]
301 #include <cras_cpp_common/log_utils/deprecated/macros.h>
::cras::LogHelperConstPtr getCrasLogger()
Get the default logger used for CRAS_* logging macros. It will never be null.
void setGlobalLogger() const
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().
void log(::ros::console::Level level, const char *format,...) const
Log a message using the given log severity.
::std::shared_ptr< const ::cras::LogHelper > ConstPtr
Const pointer to LogHelper.
::cras::LogHelperPtr log
Log helper.
ROS logging helpers macros. Do not include this file directly. Include log_utils.h instead...
virtual void logString(void *logger, ::ros::console::Level level, const ::std::string &str, const char *file, uint32_t line, const char *function) const =0
Write the given string to the log.
::cras::LogHelperConstPtr setCrasLogger(const ::cras::LogHelperConstPtr &log)
Set the default logger used by CRAS_* macros.
::cras::LogHelper::ConstPtr LogHelperConstPtr
Const pointer to LogHelper.
int8_t logLevelToRosgraphMsgLevel(::ros::console::Level rosLevel)
Convert the given rosconsole logging level to rosgraph_msgs::Log level constant.
Log helper relaying all of its work to the same mechanism used by ROS_* logging macros.
bool initialized
Whether initialize() has been called at least once. Subclasses are required to handle this invariant...
virtual void initializeImpl() const =0
Initialize the logger. It is not needed to check initialized as this function is only called when it ...
LogHelper & operator=(const LogHelper &)=delete
friend class WrapperLogHelper
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...
#define ROSCONSOLE_PRINTF_ATTRIBUTE(a, b)
::std::shared_ptr<::cras::LogHelper > Ptr
Pointer to LogHelper.
inline ::std::string format(const char *format, ::va_list args)
virtual void setLogLocationLevel(::ros::console::LogLocation *loc, ::ros::console::Level level) const
Set level of a log location. This is only called when global logging level changes.
virtual void checkLogLocationEnabled(::ros::console::LogLocation *loc) const
Check whether the log location is enabled.
void restorePreviousCrasLogger()
void initialize() const
Initialize the logger. This function does what it needs and then calls initializeImpl().
::ros::console::Level rosgraphMsgLevelToLogLevel(uint8_t msgLevel)
Convert the given rosgraph_msgs::Log level constant to rosconsole logging level.
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 ma...
Convenience base class for providing this->log and getCrasLogger(). Just add it as a base to your cla...
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.
Utils for working with strings.
virtual const void * getId() const
Return a unique identifier of this logger. These IDs are used for determining which logger has alread...
This class (reps. its descendants) provides unified access to ROS logging functions, be it ROS_* or NODELET_*.
virtual ~LogHelper()=default
::cras::LogHelper::Ptr LogHelperPtr
Pointer to LogHelper.