Skip to content

Commit

Permalink
Merge pull request #1062 from yuusuke/improbe_logging
Browse files Browse the repository at this point in the history
Improvement of the log
  • Loading branch information
kgaillot committed Jun 14, 2016
2 parents dd46368 + 5a5cc7d commit 7130937
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
20 changes: 12 additions & 8 deletions crmd/lrm.c
Expand Up @@ -2368,33 +2368,37 @@ process_lrm_event(lrm_state_t * lrm_state, lrmd_event_data_t * op, struct recurr
case PCMK_LRM_OP_CANCELLED:
crm_info("Result of %s operation for %s on %s: %s "
CRM_XS " call=%d key=%s confirmed=%s",
op->op_type, op->rsc_id, lrm_state->node_name,
crm_action_str(op->op_type, op->interval),
op->rsc_id, lrm_state->node_name,
services_lrm_status_str(op->op_status),
op->call_id, op_key, (removed? "true" : "false"));
break;

case PCMK_LRM_OP_DONE:
do_crm_log(op->interval?LOG_INFO:LOG_NOTICE,
"Result of %s operation for %s on %s: %s "
CRM_XS " call=%d key=%s confirmed=%s rc=%d cib-update=%d",
op->op_type, op->rsc_id, lrm_state->node_name,
services_ocf_exitcode_str(op->rc),
"Result of %s operation for %s on %s: %d (%s) "
CRM_XS " call=%d key=%s confirmed=%s cib-update=%d",
crm_action_str(op->op_type, op->interval),
op->rsc_id, lrm_state->node_name,
op->rc, services_ocf_exitcode_str(op->rc),
op->call_id, op_key, (removed? "true" : "false"),
op->rc, update_id);
update_id);
break;

case PCMK_LRM_OP_TIMEOUT:
crm_err("Result of %s operation for %s on %s: %s "
CRM_XS " call=%d key=%s timeout=%dms",
op->op_type, op->rsc_id, lrm_state->node_name,
crm_action_str(op->op_type, op->interval),
op->rsc_id, lrm_state->node_name,
services_lrm_status_str(op->op_status),
op->call_id, op_key, op->timeout);
break;

default:
crm_err("Result of %s operation for %s on %s: %s "
CRM_XS " call=%d key=%s confirmed=%s status=%d cib-update=%d",
op->op_type, op->rsc_id, lrm_state->node_name,
crm_action_str(op->op_type, op->interval),
op->rsc_id, lrm_state->node_name,
services_lrm_status_str(op->op_status), op->call_id, op_key,
(removed? "true" : "false"), op->op_status, update_id);
}
Expand Down
7 changes: 7 additions & 0 deletions include/crm/crm.h
Expand Up @@ -200,4 +200,11 @@ typedef GList *GListPtr;
guint crm_strcase_hash(gconstpointer v);
guint g_str_hash_traditional(gconstpointer v);

static inline const char *crm_action_str(const char *task, int interval) {
if(safe_str_eq(task, RSC_STATUS) && !interval) {
return "probe";
}
return task;
}

#endif

0 comments on commit 7130937

Please sign in to comment.