remove fprintf, use logging macros (#152)

* remove fprintf, use logging macros

* consistent includes
This commit is contained in:
Karsten Knese 2017-07-27 07:55:26 -07:00 committed by GitHub
parent 2d961fb501
commit 5cdef527de
13 changed files with 53 additions and 46 deletions

View file

@ -24,6 +24,8 @@ extern "C"
#include "rcl/rcl.h"
#include "rcl/error_handling.h"
#include "rcutils/logging_macros.h"
#include "rcl_lifecycle/rcl_lifecycle.h"
#include "rcl_lifecycle/transition_map.h"
@ -148,8 +150,8 @@ rcl_lifecycle_is_valid_transition(
return &current_state->valid_transitions[i];
}
}
fprintf(stderr, "%s:%u, No callback transition matching %d found for current state %s\n",
__FILE__, __LINE__, key, state_machine->current_state->label);
RCUTILS_LOG_WARN("No callback transition matching %d found for current state %s",
key, state_machine->current_state->label)
return NULL;
}
@ -163,14 +165,14 @@ rcl_lifecycle_trigger_transition(
// If we have a faulty transition pointer
if (!transition) {
fprintf(stderr, "No transition found for node %s with key %d\n",
state_machine->current_state->label, key);
RCUTILS_LOG_ERROR("No transition found for node %s with key %d",
state_machine->current_state->label, key)
RCL_SET_ERROR_MSG("Transition is not registered.", rcl_get_default_allocator());
return RCL_RET_ERROR;
}
if (!transition->goal) {
fprintf(stderr, "No valid goal is set\n");
RCUTILS_LOG_ERROR("No valid goal is set")
}
state_machine->current_state = transition->goal;
if (publish_notification) {