From 70dbf2e87a0707c690c871460fa4045f33d89aec Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Fri, 13 Oct 2017 20:54:40 +0530 Subject: [PATCH 1/8] Add rmw_log_level_t enum to enable setting log levels for the lowlevel DDS api's * This patch enables support for three basic log levels * There needs an API inside the DDS specific rmw implementation i.e rmw_fastrtps/rmw_opensplice etc to convert the enum to DDS specific variable Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/types.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index be2c4fee..68a206ba 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -229,6 +229,13 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0}; +enum RMW_PUBLIC_TYPE rmw_log_level_t +{ + RMW_LOG_LEVEL_ERROR, + RMW_LOG_LEVEL_WARNING, + RMW_LOG_LEVEL_INFO, +}; + #if __cplusplus } #endif From 2e2725cbad50293b1351e57f921db5aab66ddca5 Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Sun, 15 Oct 2017 23:07:34 +0530 Subject: [PATCH 2/8] Update changes based on github discussion based on https://github.com/ros2/rmw/pull/124#issuecomment-336526120 Using rcutils based log level, mapping them onto rmw specific ones. Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/types.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index 68a206ba..04eb32b2 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -25,6 +25,8 @@ extern "C" #include #include "rmw/visibility_control.h" +// map rcutils specific log levels to rmw speicfic type +#include typedef int rmw_ret_t; #define RMW_RET_OK 0 @@ -229,11 +231,16 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0}; +// Creating a map of rcutil log level types to +// rmw specific types. Check with dds available types +// before using these. enum RMW_PUBLIC_TYPE rmw_log_level_t { - RMW_LOG_LEVEL_ERROR, - RMW_LOG_LEVEL_WARNING, - RMW_LOG_LEVEL_INFO, + RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG, + RMW_LOG_SEVERITY_INFO = RCUTILS_LOG_SEVERITY_INFO, + RMW_LOG_SEVERITY_WARN = RCUTILS_LOG_SEVERITY_WARN, + RMW_LOG_SEVERITY_ERROR = RCUTILS_LOG_SEVERITY_ERROR, + RMW_LOG_SEVERITY_FATAL = RCUTILS_LOG_SEVERITY_FATAL }; #if __cplusplus From 4d9a652a98ac04a6832177e27405bf824e3f975e Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Fri, 20 Oct 2017 12:37:08 +0530 Subject: [PATCH 3/8] Minor changes to existing code. Fix comment consistency and spacing consistency. Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/types.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index 04eb32b2..e8fdb763 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -231,14 +231,13 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0}; -// Creating a map of rcutil log level types to -// rmw specific types. Check with dds available types -// before using these. +// Type mapping of rcutil log severity types to +// rmw specific types. enum RMW_PUBLIC_TYPE rmw_log_level_t { RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG, - RMW_LOG_SEVERITY_INFO = RCUTILS_LOG_SEVERITY_INFO, - RMW_LOG_SEVERITY_WARN = RCUTILS_LOG_SEVERITY_WARN, + RMW_LOG_SEVERITY_INFO = RCUTILS_LOG_SEVERITY_INFO, + RMW_LOG_SEVERITY_WARN = RCUTILS_LOG_SEVERITY_WARN, RMW_LOG_SEVERITY_ERROR = RCUTILS_LOG_SEVERITY_ERROR, RMW_LOG_SEVERITY_FATAL = RCUTILS_LOG_SEVERITY_FATAL }; From c92c0f0dd889b8f4ea0ef9a68b5e57852c723c36 Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Fri, 20 Oct 2017 15:12:31 +0530 Subject: [PATCH 4/8] Change variable name for consistency Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index e8fdb763..53207599 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -233,7 +233,7 @@ enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0}; // Type mapping of rcutil log severity types to // rmw specific types. -enum RMW_PUBLIC_TYPE rmw_log_level_t +enum RMW_PUBLIC_TYPE rmw_log_severity_t { RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG, RMW_LOG_SEVERITY_INFO = RCUTILS_LOG_SEVERITY_INFO, From 3eeeaba46cbb42bd9d51cfa8030b675045bcdd17 Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Wed, 25 Oct 2017 12:54:32 +0530 Subject: [PATCH 5/8] Add, rmw_log_set_severity API to rmw.h. This follows the set of patches across ros2 sources for setting log levels inside DDS implementation Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/rmw.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rmw/include/rmw/rmw.h b/rmw/include/rmw/rmw.h index 248350cf..d4f156da 100644 --- a/rmw/include/rmw/rmw.h +++ b/rmw/include/rmw/rmw.h @@ -410,6 +410,11 @@ rmw_service_server_is_available( const rmw_client_t * client, bool * is_available); +RMW_PUBLIC +RMW_WARN_UNUSED +rmw_ret_t +rmw_set_log_severity(rmw_log_severity_t * severity); + #if __cplusplus } #endif From b8cdfec9c1bcf1ee1c7081640064a252efb7b9a9 Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Wed, 25 Oct 2017 14:04:50 +0530 Subject: [PATCH 6/8] Remove pointer to variable severity, from the github discussions it was'nt needed Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/rmw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw/include/rmw/rmw.h b/rmw/include/rmw/rmw.h index d4f156da..6b5b3591 100644 --- a/rmw/include/rmw/rmw.h +++ b/rmw/include/rmw/rmw.h @@ -413,7 +413,7 @@ rmw_service_server_is_available( RMW_PUBLIC RMW_WARN_UNUSED rmw_ret_t -rmw_set_log_severity(rmw_log_severity_t * severity); +rmw_set_log_severity(rmw_log_severity_t severity); #if __cplusplus } From 546619ac1ce7126d9fd8aa3128a082e9bdd9d8ac Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Thu, 26 Oct 2017 13:42:06 +0530 Subject: [PATCH 7/8] Fix enum declaration errors Signed-off-by: Sriram Raghunathan --- rmw/include/rmw/types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index 53207599..13d334bf 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -233,14 +233,14 @@ enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0}; // Type mapping of rcutil log severity types to // rmw specific types. -enum RMW_PUBLIC_TYPE rmw_log_severity_t +typedef enum RWM_PUBLIC_TYPE { RMW_LOG_SEVERITY_DEBUG = RCUTILS_LOG_SEVERITY_DEBUG, RMW_LOG_SEVERITY_INFO = RCUTILS_LOG_SEVERITY_INFO, RMW_LOG_SEVERITY_WARN = RCUTILS_LOG_SEVERITY_WARN, RMW_LOG_SEVERITY_ERROR = RCUTILS_LOG_SEVERITY_ERROR, RMW_LOG_SEVERITY_FATAL = RCUTILS_LOG_SEVERITY_FATAL -}; +}rmw_log_severity_t; #if __cplusplus } From fe8daede9742a03bf3af50721740e37afb5efa00 Mon Sep 17 00:00:00 2001 From: Sriram Raghunathan Date: Sun, 7 Jan 2018 10:44:34 +0530 Subject: [PATCH 8/8] Fix code styling issues --- rmw/include/rmw/types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw/include/rmw/types.h b/rmw/include/rmw/types.h index 6a8c294d..06463871 100644 --- a/rmw/include/rmw/types.h +++ b/rmw/include/rmw/types.h @@ -24,9 +24,9 @@ extern "C" #include #include -#include "rmw/visibility_control.h" // map rcutils specific log levels to rmw speicfic type #include +#include "rmw/visibility_control.h" typedef int rmw_ret_t; #define RMW_RET_OK 0 @@ -239,7 +239,7 @@ typedef enum RWM_PUBLIC_TYPE RMW_LOG_SEVERITY_WARN = RCUTILS_LOG_SEVERITY_WARN, RMW_LOG_SEVERITY_ERROR = RCUTILS_LOG_SEVERITY_ERROR, RMW_LOG_SEVERITY_FATAL = RCUTILS_LOG_SEVERITY_FATAL -}rmw_log_severity_t; +} rmw_log_severity_t; #if __cplusplus }