Skip to content

Commit

Permalink
Enable setting log levels in DDS implementation (#124)
Browse files Browse the repository at this point in the history
* 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 <sriram.max@gmail.com>

* Update changes based on github discussion based on

#124 (comment)

Using rcutils based log level, mapping them onto rmw specific
ones.

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Minor changes to existing code. Fix comment consistency and spacing consistency.

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Change variable name for consistency

Signed-off-by: Sriram Raghunathan <rsriram7@visteon.com>

* 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 <sriram.max@gmail.com>

* Remove pointer to variable severity, from the github discussions it was'nt needed

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Fix enum declaration errors

Signed-off-by: Sriram Raghunathan <sriram.max@gmail.com>

* Fix code styling issues
  • Loading branch information
sriramster authored and dirk-thomas committed Jan 18, 2018
1 parent 589c69e commit d75889e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rmw/include/rmw/rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions rmw/include/rmw/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ extern "C"
#include <stddef.h>
#include <stdint.h>

// map rcutils specific log levels to rmw speicfic type
#include <rcutils/logging.h>
#include "rmw/visibility_control.h"

typedef int rmw_ret_t;
Expand Down Expand Up @@ -228,6 +230,17 @@ typedef struct RMW_PUBLIC_TYPE rmw_message_info_t

enum {RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT = 0};

// Type mapping of rcutil log severity types to
// rmw specific types.
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
}
#endif
Expand Down

0 comments on commit d75889e

Please sign in to comment.