diff --git a/rcl/CMakeLists.txt b/rcl/CMakeLists.txt index cbc267792..284337fdd 100644 --- a/rcl/CMakeLists.txt +++ b/rcl/CMakeLists.txt @@ -5,6 +5,7 @@ project(rcl) find_package(ament_cmake_ros REQUIRED) find_package(rcl_interfaces REQUIRED) +find_package(rcl_logging_interface REQUIRED) find_package(rcl_yaml_param_parser REQUIRED) find_package(rcutils REQUIRED) find_package(rmw REQUIRED) @@ -69,6 +70,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC # specific order: dependents before dependencies ament_target_dependencies(${PROJECT_NAME} "rcl_interfaces" + "rcl_logging_interface" "rcl_yaml_param_parser" "rcutils" "rmw" @@ -102,6 +104,7 @@ ament_export_targets(${PROJECT_NAME}) ament_export_dependencies(ament_cmake) ament_export_dependencies(rcl_interfaces) +ament_export_dependencies(rcl_logging_interface) ament_export_dependencies(rcl_yaml_param_parser) ament_export_dependencies(rmw_implementation) ament_export_dependencies(rmw) diff --git a/rcl/include/rcl/logging_external_interface.h b/rcl/include/rcl/logging_external_interface.h deleted file mode 100644 index 97961a772..000000000 --- a/rcl/include/rcl/logging_external_interface.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2018 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef RCL__LOGGING_EXTERNAL_INTERFACE_H_ -#define RCL__LOGGING_EXTERNAL_INTERFACE_H_ - -#include "rcl/macros.h" -#include "rcl/types.h" -#include "rcl/visibility_control.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// Initialize the external logging library. -/** - * \param[in] config_file The location of a config file that the external - * logging library should use to configure itself. - * If no config file is provided this will be set to an empty string. - * Must be a NULL terminated c string. - * \param[in] allocator The allocator to use for memory allocation. This is - * an rcutils_allocator_t rather than an rcl_allocator_t to ensure that the - * rcl_logging_* packages don't have a circular dependency back to rcl. - * \todo TODO(clalancette) This API is marked RCL_PUBLIC, but is not built or - * exported from librcl. Instead, these headers should be split into a - * separate package which is then depended on by both rcl and the - * rcl_logging_* implementations. The duplicated headers from the - * implementations could then be removed. - * \return RCL_RET_OK if initialized successfully, or - * \return RCL_RET_ERROR if an unspecified error occurs. - */ -RCL_PUBLIC -RCL_WARN_UNUSED -rcl_ret_t -rcl_logging_external_initialize(const char * config_file, rcutils_allocator_t allocator); - -/// Free the resources allocated for the external logging system. -/** - * This puts the system into a state equivalent to being uninitialized. - * - * \return RCL_RET_OK if successfully shutdown, or - * \return RCL_RET_ERROR if an unspecified error occurs. - */ -RCL_PUBLIC -RCL_WARN_UNUSED -rcl_ret_t -rcl_logging_external_shutdown(); - -/// Log a message. -/** - * \param[in] severity The severity level of the message being logged. - * \param[in] name The name of the logger, must either be a null terminated - * c string or NULL. - * If NULL or empty the root logger will be used. - * \param[in] msg The message to be logged. Must be a null terminated c string. - */ -RCL_PUBLIC -void -rcl_logging_external_log(int severity, const char * name, const char * msg); - -/// Set the severity level for a logger. -/** - * This function sets the severity level for the specified logger. - * If the name provided is an empty string or NULL it will change the level of - * the root logger. - * - * \param[in] name The name of the logger. - * Must be a NULL terminated c string or NULL. - * \param[in] level The severity level to be used for the specified logger. - * \return RCL_RET_OK if set successfully, or - * \return RCL_RET_ERROR if an unspecified error occurs. - */ -RCL_PUBLIC -RCL_WARN_UNUSED -rcl_ret_t rcl_logging_external_set_logger_level(const char * name, int level); - -#ifdef __cplusplus -} -#endif - -#endif // RCL__LOGGING_EXTERNAL_INTERFACE_H_ diff --git a/rcl/package.xml b/rcl/package.xml index cf8c08224..67c0c17aa 100644 --- a/rcl/package.xml +++ b/rcl/package.xml @@ -14,6 +14,7 @@ rmw rcl_interfaces + rcl_logging_interface rcl_logging_spdlog rcl_yaml_param_parser rcutils diff --git a/rcl/src/rcl/logging.c b/rcl/src/rcl/logging.c index 71c778388..d6e6d6070 100644 --- a/rcl/src/rcl/logging.c +++ b/rcl/src/rcl/logging.c @@ -26,7 +26,7 @@ extern "C" #include "rcl/allocator.h" #include "rcl/error_handling.h" #include "rcl/logging.h" -#include "rcl/logging_external_interface.h" +#include "rcl_logging_interface/rcl_logging_interface.h" #include "rcl/logging_rosout.h" #include "rcl/macros.h" #include "rcutils/logging.h"