Skip to content

Commit

Permalink
Include rclcpp/logging.hpp instead of rclcpp/rclcpp.hpp in RosImpleme…
Browse files Browse the repository at this point in the history
…ntation for the text logging class
  • Loading branch information
GiulioRomualdi committed Feb 3, 2023
1 parent 8d711db commit b6d6f5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file RosLogger.h
* @authors Giulio Romualdi
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and
* @copyright 2023 Istituto Italiano di Tecnologia (IIT). This software may be modified and
* distributed under the terms of the BSD-3-Clause license.
*/

Expand All @@ -17,7 +17,7 @@

#include <BipedalLocomotion/TextLogging/Logger.h>

#include <rclcpp/rclcpp.hpp>
#include <rclcpp/logging.hpp>

namespace BipedalLocomotion
{
Expand Down Expand Up @@ -77,9 +77,8 @@ template <typename Mutex> class RosSink : public spdlog::sinks::base_sink<Mutex>
using RosSink_mt = RosSink<std::mutex>;
} // namespace sinks


/**
* RosLoggerFactory implements the factory you should use to enable the sink using yaro.
* RosLoggerFactory implements the factory you should use to enable the sink using ros.
* The ROS logger can be easily used as follows
* \code{.cpp}
* #include <BipedalLocomotion/TextLogging/Logger.h>
Expand Down
9 changes: 5 additions & 4 deletions src/TextLogging/RosImplementation/src/RosLogger.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
/**
* @file RosLogger.cpp
* @authors Giulio Romualdi
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and
* @copyright 2023 Istituto Italiano di Tecnologia (IIT). This software may be modified and
* distributed under the terms of the BSD-3-Clause license.
*/

#include <mutex>

#include <BipedalLocomotion/TextLogging/RosLogger.h>

#include <rclcpp/rclcpp.hpp>
#include <rclcpp/logging.hpp>

namespace BipedalLocomotion
{

template <typename Factory = spdlog::synchronous_factory>
inline std::shared_ptr<TextLogging::Logger> RosSink_mt(const std::string& loggerName, const rclcpp::Logger& rosLogger)
inline std::shared_ptr<TextLogging::Logger>
RosSink_mt(const std::string& loggerName, const rclcpp::Logger& rosLogger)
{
return Factory::template create<TextLogging::sinks::RosSink_mt>(loggerName, rosLogger);
}
Expand All @@ -42,7 +43,7 @@ _createLogger(const std::string& name, const rclcpp::Logger& rosLogger)
#endif // NDEBUG

// set the custom pattern
logger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [thread: %t] [%n] %v");
logger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [thread: %t] %v");
}
return logger;
}
Expand Down

0 comments on commit b6d6f5d

Please sign in to comment.