Skip to content

Commit 438822f

Browse files
authored
Revert "Add get_logging_directory method to rclcpp::Logger (#1509)" (#1511)
This reverts commit 7a31d7c. Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
1 parent 7a31d7c commit 438822f

3 files changed

Lines changed: 0 additions & 55 deletions

File tree

rclcpp/include/rclcpp/logger.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222

2323
#include "rcl/node.h"
2424
#include "rcutils/logging.h"
25-
#ifdef _WIN32
26-
# ifndef NOMINMAX
27-
# define NOMINMAX
28-
# endif
29-
#endif
30-
#include "rcpputils/filesystem_helper.hpp"
3125

3226
/**
3327
* \def RCLCPP_LOGGING_ENABLED
@@ -81,18 +75,6 @@ RCLCPP_PUBLIC
8175
Logger
8276
get_node_logger(const rcl_node_t * node);
8377

84-
/// Get the current logging directory.
85-
/**
86-
* For more details of how the logging directory is determined,
87-
* see \ref rcl_logging_get_logging_directory.
88-
*
89-
* \returns the logging directory being used.
90-
* \throws rclcpp::exceptions::RCLError if an unexpected error occurs.
91-
*/
92-
RCLCPP_PUBLIC
93-
rcpputils::fs::path
94-
get_logging_directory();
95-
9678
class Logger
9779
{
9880
public:

rclcpp/src/rclcpp/logger.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#include <string>
1616

17-
#include "rcl_logging_interface/rcl_logging_interface.h"
18-
1917
#include "rclcpp/exceptions.hpp"
2018
#include "rclcpp/logger.hpp"
2119
#include "rclcpp/logging.hpp"
@@ -48,20 +46,6 @@ get_node_logger(const rcl_node_t * node)
4846
return rclcpp::get_logger(logger_name);
4947
}
5048

51-
rcpputils::fs::path
52-
get_logging_directory()
53-
{
54-
char * log_dir = NULL;
55-
auto allocator = rcutils_get_default_allocator();
56-
rcl_logging_ret_t ret = rcl_logging_get_logging_directory(allocator, &log_dir);
57-
if (RCL_LOGGING_RET_OK != ret) {
58-
rclcpp::exceptions::throw_from_rcl_error(ret);
59-
}
60-
std::string path{log_dir};
61-
allocator.deallocate(log_dir, allocator.state);
62-
return path;
63-
}
64-
6549
void
6650
Logger::set_level(Level level)
6751
{

rclcpp/test/rclcpp/test_logger.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <memory>
1818
#include <string>
1919

20-
#include "rcutils/env.h"
21-
2220
#include "rclcpp/logger.hpp"
2321
#include "rclcpp/logging.hpp"
2422
#include "rclcpp/node.hpp"
@@ -159,22 +157,3 @@ TEST(TestLogger, set_level) {
159157
rcutils_logging_set_output_handler(previous_output_handler);
160158
EXPECT_EQ(RCUTILS_RET_OK, rcutils_logging_shutdown());
161159
}
162-
163-
TEST(TestLogger, get_logging_directory) {
164-
ASSERT_EQ(true, rcutils_set_env("HOME", "/fake_home_dir"));
165-
ASSERT_EQ(true, rcutils_set_env("USERPROFILE", nullptr));
166-
ASSERT_EQ(true, rcutils_set_env("ROS_LOG_DIR", nullptr));
167-
ASSERT_EQ(true, rcutils_set_env("ROS_HOME", nullptr));
168-
169-
auto path = rclcpp::get_logging_directory();
170-
auto expected_path = rcpputils::fs::path{"/fake_home_dir"} / ".ros" / "log";
171-
172-
// TODO(ivanpauno): Add operator== to rcpputils::fs::path
173-
auto it = path.cbegin();
174-
auto eit = expected_path.cbegin();
175-
for (; it != path.cend() && eit != expected_path.cend(); ++it, ++eit) {
176-
EXPECT_EQ(*eit, *it);
177-
}
178-
EXPECT_EQ(it, path.cend());
179-
EXPECT_EQ(eit, expected_path.cend());
180-
}

0 commit comments

Comments
 (0)