memory.h
Go to the documentation of this file.
1 #pragma once
2 
3 // SPDX-License-Identifier: BSD-3-Clause
4 // SPDX-FileCopyrightText: Czech Technical University in Prague
5 
12 #include <list>
13 #include <string>
14 
15 #include <ros/console.h>
16 #include <ros/time.h>
17 #include <rosgraph_msgs/Log.h>
18 
20 
21 namespace cras
22 {
23 
28 {
29 public:
30  void initializeImpl() const override;
31 
32  void initializeLogLocationImpl(::ros::console::LogLocation* loc, const ::std::string& name,
33  ::ros::console::Level level) const override;
34 
35  void setLogLocationLevel(::ros::console::LogLocation* loc, ::ros::console::Level level) const override;
36 
37  void checkLogLocationEnabled(::ros::console::LogLocation* loc) const override;
38 
39  void logString(void* logger, ::ros::console::Level level, const std::string& str, const char* file, uint32_t line,
40  const char* function) const override;
41 
46  const ::std::list<::rosgraph_msgs::Log>& getMessages() const;
47 
51  void clear() const;
52 
53 protected:
54  mutable ::std::list<::rosgraph_msgs::Log> messages;
55  mutable ::std::list<::std::string> loggerNames;
56 };
57 
58 }
cras::LogHelper
This class (reps. its descendants) provides unified access to ROS logging functions,...
Definition: log_utils.h:52
cras
Definition: any.hpp:15
cras::MemoryLogHelper::loggerNames
mutable ::std::list<::std::string > loggerNames
Cache of names of known loggers. Do not ever erase items.
Definition: memory.h:55
cras::MemoryLogHelper::clear
void clear() const
Delete all messages logged so far.
time.h
cras::MemoryLogHelper::initializeLogLocationImpl
void initializeLogLocationImpl(::ros::console::LogLocation *loc, const ::std::string &name, ::ros::console::Level level) const override
cras::MemoryLogHelper::getMessages
const ::std::list<::rosgraph_msgs::Log > & getMessages() const
Return all messages logged so far.
cras::MemoryLogHelper::logString
void logString(void *logger, ::ros::console::Level level, const std::string &str, const char *file, uint32_t line, const char *function) const override
cras::MemoryLogHelper::messages
mutable ::std::list<::rosgraph_msgs::Log > messages
The list of logged messages.
Definition: memory.h:54
console.h
cras::MemoryLogHelper
Definition: memory.h:27
ros::console::levels::Level
Level
log_utils.h
ROS logging helpers.
cras::MemoryLogHelper::initializeImpl
void initializeImpl() const override
Initialize the logger. It is not needed to check initialized as this function is only called when it ...
cras::MemoryLogHelper::setLogLocationLevel
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.
cras::MemoryLogHelper::checkLogLocationEnabled
void checkLogLocationEnabled(::ros::console::LogLocation *loc) const override
Check whether the log location is enabled.
ros::console::LogLocation


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