Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove logging on Micro-ROS rcutils #7

Merged
merged 6 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions include/rcutils/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,18 +538,23 @@ void rcutils_logging_console_output_handler(
* Usually it is unnecessary to call the macro directly.
* All logging macros ensure that this has been called once.
*/
#define RCUTILS_LOGGING_AUTOINIT \
if (RCUTILS_UNLIKELY(!g_rcutils_logging_initialized)) { \
rcutils_ret_t ret = rcutils_logging_initialize(); \
if (ret != RCUTILS_RET_OK) { \
RCUTILS_SAFE_FWRITE_TO_STDERR( \
"[rcutils|" __FILE__ ":" RCUTILS_STRINGIFY(__LINE__) \
"] error initializing logging: "); \
RCUTILS_SAFE_FWRITE_TO_STDERR(rcutils_get_error_string().str); \
RCUTILS_SAFE_FWRITE_TO_STDERR("\n"); \
rcutils_reset_error(); \
} \
}

#define RCUTILS_LOGGING_AUTOINIT
jamoralp marked this conversation as resolved.
Show resolved Hide resolved

/**
* #define RCUTILS_LOGGING_AUTOINIT \
* if (RCUTILS_UNLIKELY(!g_rcutils_logging_initialized)) { \
* rcutils_ret_t ret = rcutils_logging_initialize(); \
* if (ret != RCUTILS_RET_OK) { \
* RCUTILS_SAFE_FWRITE_TO_STDERR( \
* "[rcutils|" __FILE__ ":" RCUTILS_STRINGIFY(__LINE__) \
* "] error initializing logging: "); \
* RCUTILS_SAFE_FWRITE_TO_STDERR(rcutils_get_error_string().str); \
* RCUTILS_SAFE_FWRITE_TO_STDERR("\n"); \
* rcutils_reset_error(); \
* } \
* }
*/

#ifdef __cplusplus
}
Expand Down
24 changes: 14 additions & 10 deletions src/error_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,22 @@ rcutils_get_error_string(void)
return gtls_rcutils_error_string;
}

// void
jamoralp marked this conversation as resolved.
Show resolved Hide resolved
// rcutils_reset_error(void)
// {
// gtls_rcutils_error_state = (const rcutils_error_state_t) {
// .message = {0}, .file = {0}, .line_number = 0
// }; // NOLINT(readability/braces)
// gtls_rcutils_error_string_is_formatted = false;
// gtls_rcutils_error_string = (const rcutils_error_string_t) {
// .str = "\0"
// };
// gtls_rcutils_error_is_set = false;
// }

void
rcutils_reset_error(void)
{
gtls_rcutils_error_state = (const rcutils_error_state_t) {
.message = {0}, .file = {0}, .line_number = 0
}; // NOLINT(readability/braces)
gtls_rcutils_error_string_is_formatted = false;
gtls_rcutils_error_string = (const rcutils_error_string_t) {
.str = "\0"
};
gtls_rcutils_error_is_set = false;
}
{}

#ifdef __cplusplus
}
Expand Down