当前位置: 首页>>代码示例>>C++>>正文


C++ do_crm_log函数代码示例

本文整理汇总了C++中do_crm_log函数的典型用法代码示例。如果您正苦于以下问题:C++ do_crm_log函数的具体用法?C++ do_crm_log怎么用?C++ do_crm_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了do_crm_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: print_graph

void
print_graph(unsigned int log_level, crm_graph_t *graph)
{
	if(graph == NULL || graph->num_actions == 0) {
		if(log_level > LOG_DEBUG) {
			crm_debug("## Empty transition graph ##");
		}
		return;
	}
		
	do_crm_log(log_level, "Graph %d (%d actions in %d synapses):"
		   " batch-limit=%d jobs, network-delay=%dms",
		   graph->id, graph->num_actions, graph->num_synapses,
		   graph->batch_limit, graph->network_delay);
	
	slist_iter(
		synapse, synapse_t, graph->synapses, lpc,

		do_crm_log(log_level, "Synapse %d %s (priority: %d)",
			      synapse->id,
			      synapse->confirmed?"was confirmed":
			        synapse->executed?"was executed":
			      "is pending",
			      synapse->priority);
		
		if(synapse->confirmed == FALSE) {
			slist_iter(
				action, crm_action_t, synapse->actions, lpc2,
				print_elem(log_level, "    ", FALSE, action);
				);
开发者ID:sipwise,项目名称:heartbeat,代码行数:30,代码来源:utils.c

示例2: abort_transition_graph

void
abort_transition_graph(
	int abort_priority, enum transition_action abort_action,
	const char *abort_text, crm_data_t *reason, const char *fn, int line) 
{
	int log_level = LOG_DEBUG;
/*
	if(abort_priority >= INFINITY) {
		log_level = LOG_INFO;
	}
*/
	update_abort_priority(
		transition_graph, abort_priority, abort_action, abort_text);

	do_crm_log(log_level, "%s:%d - Triggered graph processing : %s",
		      fn, line, abort_text);

	if(reason != NULL) {
		const char *magic = crm_element_value(
			reason, XML_ATTR_TRANSITION_MAGIC);
		if(magic) {
			do_crm_log(log_level, "Caused by update to %s: %s",
				   ID(reason), magic);
		} else {
			crm_log_xml(log_level, "Cause", reason);
		}
	}
	
	if(transition_graph->complete) {
		notify_crmd(transition_graph);
		
	} else {
		G_main_set_trigger(transition_trigger);
	}
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:35,代码来源:utils.c

示例3: attrd_cib_callback

static void
attrd_cib_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data)
{
    int level = LOG_ERR;
    GHashTableIter iter;
    const char *peer = NULL;
    attribute_value_t *v = NULL;

    char *name = user_data;
    attribute_t *a = g_hash_table_lookup(attributes, name);

    if(a == NULL) {
        crm_info("Attribute %s no longer exists", name);
        goto done;
    }

    a->update = 0;
    if (rc == pcmk_ok && call_id < 0) {
        rc = call_id;
    }

    switch (rc) {
        case pcmk_ok:
            level = LOG_INFO;
            last_cib_op_done = call_id;
            break;
        case -pcmk_err_diff_failed:    /* When an attr changes while the CIB is syncing */
        case -ETIME:           /* When an attr changes while there is a DC election */
        case -ENXIO:           /* When an attr changes while the CIB is syncing a
                                *   newer config from a node that just came up
                                */
            level = LOG_WARNING;
            break;
    }

    do_crm_log(level, "Update %d for %s: %s (%d)", call_id, name, pcmk_strerror(rc), rc);

    g_hash_table_iter_init(&iter, a->values);
    while (g_hash_table_iter_next(&iter, (gpointer *) & peer, (gpointer *) & v)) {
        do_crm_log(level, "Update %d for %s[%s]=%s: %s (%d)", call_id, a->id, peer, v->requested, pcmk_strerror(rc), rc);

        if(rc == pcmk_ok) {
            free(v->stored);
            v->stored = v->requested;
            v->requested = NULL;

        } else {
            free(v->requested);
            v->requested = NULL;
            a->changed = TRUE; /* Attempt write out again */
        }
    }
  done:
    free(name);
    if(a && a->changed && election_state(writer) == election_won) {
        write_attribute(a);
    }
}
开发者ID:SynetoNet,项目名称:pacemaker,代码行数:58,代码来源:commands.c

示例4: log_hash_entry

static void
log_hash_entry(int level, attr_hash_entry_t * entry, const char *text)
{
    do_crm_log(level, "%s", text);
    do_crm_log(level, "Set:     %s", entry->section);
    do_crm_log(level, "Name:    %s", entry->id);
    do_crm_log(level, "Value:   %s", entry->value);
    do_crm_log(level, "Timeout: %s", entry->dampen);
}
开发者ID:brhellman,项目名称:pacemaker,代码行数:9,代码来源:attrd.c

示例5: crm_glib_handler

static void
crm_glib_handler(const gchar *log_domain, GLogLevelFlags flags, const gchar *message, gpointer user_data)
{
	int log_level = LOG_WARNING;
	GLogLevelFlags msg_level = (flags & G_LOG_LEVEL_MASK);

	switch(msg_level) {
	    case G_LOG_LEVEL_CRITICAL:
		/* log and record how we got here */
		crm_abort(__FILE__,__PRETTY_FUNCTION__,__LINE__, message, TRUE, TRUE);
		return;

	    case G_LOG_LEVEL_ERROR:	log_level = LOG_ERR;    break;
	    case G_LOG_LEVEL_MESSAGE:	log_level = LOG_NOTICE; break;
	    case G_LOG_LEVEL_INFO:	log_level = LOG_INFO;   break;
	    case G_LOG_LEVEL_DEBUG:	log_level = LOG_DEBUG;  break;
		
	    case G_LOG_LEVEL_WARNING:
	    case G_LOG_FLAG_RECURSION:
	    case G_LOG_FLAG_FATAL:
	    case G_LOG_LEVEL_MASK:
		log_level = LOG_WARNING;
		break;
	}

	do_crm_log(log_level, "%s: %s", log_domain, message);
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:27,代码来源:utils.c

示例6: pcmk_child_exit

static void
pcmk_child_exit(mainloop_child_t * p, pid_t pid, int core, int signo, int exitcode)
{
    pcmk_child_t *child = mainloop_child_userdata(p);
    const char *name = mainloop_child_name(p);

    if (signo) {
        crm_notice("Child process %s terminated with signal %d (pid=%d, core=%d)",
                   name, signo, pid, core);

    } else {
        do_crm_log(exitcode == 0 ? LOG_INFO : LOG_ERR,
                   "Child process %s (%d) exited: %s (%d)", name, pid, pcmk_strerror(exitcode), exitcode);
    }

    if (exitcode == 100) {
        crm_warn("Pacemaker child process %s no longer wishes to be respawned. "
                 "Shutting ourselves down.", name);
        child->respawn = FALSE;
        fatal_error = TRUE;
        pcmk_shutdown(15);
    }

    pcmk_process_exit(child);
}
开发者ID:HyunKwangYong,项目名称:pacemaker,代码行数:25,代码来源:pacemaker.c

示例7: crmd_join_phase_log

void crmd_join_phase_log(int level)
{
    crm_node_t *peer;
    GHashTableIter iter;

    g_hash_table_iter_init(&iter, crm_peer_cache);
    while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &peer)) {
        const char *state = "unknown";
        switch(peer->join) {
            case crm_join_nack:
                state = "nack";
                break;
            case crm_join_none:
                state = "none";
                break;
            case crm_join_welcomed:
                state = "welcomed";
                break;
            case crm_join_integrated:
                state = "integrated";
                break;
            case crm_join_finalized:
                state = "finalized";
                break;
            case crm_join_confirmed:
                state = "confirmed";
                break;
        }
        do_crm_log(level, "join-%d: %s=%s", current_join_id, peer->uname, state);
    }
}
开发者ID:oalbrigt,项目名称:pacemaker,代码行数:31,代码来源:join_dc.c

示例8: finalize_sync_callback

void
finalize_sync_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data)
{
    CRM_LOG_ASSERT(-EPERM != rc);
    clear_bit(fsa_input_register, R_CIB_ASKED);
    if (rc != pcmk_ok) {
        do_crm_log((rc == -pcmk_err_old_data ? LOG_WARNING : LOG_ERR),
                   "Sync from %s failed: %s", (char *)user_data, pcmk_strerror(rc));

        /* restart the whole join process */
        register_fsa_error_adv(C_FSA_INTERNAL, I_ELECTION_DC, NULL, NULL, __FUNCTION__);

    } else if (AM_I_DC && fsa_state == S_FINALIZE_JOIN) {
        set_bit(fsa_input_register, R_HAVE_CIB);
        clear_bit(fsa_input_register, R_CIB_ASKED);

        /* make sure dc_uuid is re-set to us */
        if (check_join_state(fsa_state, __FUNCTION__) == FALSE) {
            crm_debug("Notifying %d clients of join-%d results",
                      crmd_join_phase_count(crm_join_integrated), current_join_id);
            g_hash_table_foreach(crm_peer_cache, finalize_join_for, NULL);
        }

    } else {
        crm_debug("No longer the DC in S_FINALIZE_JOIN: %s/%s",
                  AM_I_DC ? "DC" : "CRMd", fsa_state2string(fsa_state));
    }
}
开发者ID:oalbrigt,项目名称:pacemaker,代码行数:28,代码来源:join_dc.c

示例9: send_ipc_message

/* frees msg */
gboolean 
send_ipc_message(IPC_Channel *ipc_client, xmlNode *msg)
{
	gboolean all_is_good = TRUE;
	int fail_level = LOG_WARNING;

	if(ipc_client != NULL && ipc_client->conntype == IPC_CLIENT) {
		fail_level = LOG_ERR;
	}

	if (msg == NULL) {
		crm_err("cant send NULL message");
		all_is_good = FALSE;

	} else if (ipc_client == NULL) {
		crm_err("cant send message without an IPC Channel");
		all_is_good = FALSE;

	} else if(ipc_client->ops->get_chan_status(ipc_client) != IPC_CONNECT) {
		do_crm_log(fail_level, "IPC Channel to %d is not connected",
			      (int)ipc_client->farside_pid);
		all_is_good = FALSE;
	}

	if(all_is_good && xml2ipcchan(msg, ipc_client) != HA_OK) {
		do_crm_log(fail_level, "Could not send IPC message to %d",
			(int)ipc_client->farside_pid);
		all_is_good = FALSE;

		if(ipc_client->ops->get_chan_status(ipc_client) != IPC_CONNECT) {
			do_crm_log(fail_level,
				      "IPC Channel to %d is no longer connected",
				      (int)ipc_client->farside_pid);

		} else if(ipc_client->conntype == IPC_CLIENT) {
			if(ipc_client->send_queue->current_qlen >= ipc_client->send_queue->max_qlen) {
				crm_err("Send queue to %d (size=%d) full.",
					ipc_client->farside_pid,
					(int)ipc_client->send_queue->max_qlen);
			}
		}
	}
	/* crm_log_xml(all_is_good?LOG_MSG:LOG_WARNING,"IPC[outbound]",msg); */
	
	return all_is_good;
}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:47,代码来源:ipc.c

示例10: print_graph

void
print_graph(unsigned int log_level, crm_graph_t * graph)
{
    GListPtr lpc = NULL;

    if (graph == NULL || graph->num_actions == 0) {
        if (log_level > LOG_DEBUG) {
            crm_debug("## Empty transition graph ##");
        }
        return;
    }

    do_crm_log(log_level, "Graph %d (%d actions in %d synapses):"
               " batch-limit=%d jobs, network-delay=%dms",
               graph->id, graph->num_actions, graph->num_synapses,
               graph->batch_limit, graph->network_delay);

    for (lpc = graph->synapses; lpc != NULL; lpc = lpc->next) {
        synapse_t *synapse = (synapse_t *) lpc->data;

        do_crm_log(log_level, "Synapse %d %s (priority: %d)",
                   synapse->id,
                   synapse->confirmed ? "was confirmed" :
                   synapse->executed ? "was executed" : "is pending", synapse->priority);

        if (synapse->confirmed == FALSE) {
            GListPtr lpc2 = NULL;

            for (lpc2 = synapse->actions; lpc2 != NULL; lpc2 = lpc2->next) {
                crm_action_t *action = (crm_action_t *) lpc2->data;

                print_elem(log_level, "    ", FALSE, action);
            }
        }
        if (synapse->executed == FALSE) {
            GListPtr lpc2 = NULL;

            for (lpc2 = synapse->inputs; lpc2 != NULL; lpc2 = lpc2->next) {
                crm_action_t *input = (crm_action_t *) lpc2->data;

                print_elem(log_level, "     * ", TRUE, input);
            }
        }
    }
}
开发者ID:fghaas,项目名称:pacemaker,代码行数:45,代码来源:utils.c

示例11: cib_diff_notify

void
cib_diff_notify(
	int options, const char *client, const char *call_id, const char *op,
	crm_data_t *update, enum cib_errors result, crm_data_t *diff) 
{
	int add_updates = 0;
	int add_epoch  = 0;
	int add_admin_epoch = 0;

	int del_updates = 0;
	int del_epoch  = 0;
	int del_admin_epoch = 0;

	int log_level = LOG_DEBUG_2;
	
	if(diff == NULL) {
		return;
	}

	if(result != cib_ok) {
		log_level = LOG_WARNING;
	}
	
	cib_diff_version_details(
		diff, &add_admin_epoch, &add_epoch, &add_updates, 
		&del_admin_epoch, &del_epoch, &del_updates);

	if(add_updates != del_updates) {
		do_crm_log(log_level,
			      "Update (client: %s%s%s): %d.%d.%d -> %d.%d.%d (%s)",
			      client, call_id?", call:":"", call_id?call_id:"",
			      del_admin_epoch, del_epoch, del_updates,
			      add_admin_epoch, add_epoch, add_updates,
			      cib_error2string(result));

	} else if(diff != NULL) {
		do_crm_log(log_level,
			      "Local-only Change (client:%s%s%s): %d.%d.%d (%s)",
			      client, call_id?", call: ":"", call_id?call_id:"",
			      add_admin_epoch, add_epoch, add_updates,
			      cib_error2string(result));
	}
	
	do_cib_notify(options, op, update, result, diff, T_CIB_DIFF_NOTIFY);
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:45,代码来源:notify.c

示例12: cibmon_diff

void
cibmon_diff(const char *event, xmlNode * msg)
{
    int rc = -1;
    const char *op = NULL;
    unsigned int log_level = LOG_INFO;

    xmlNode *diff = NULL;
    xmlNode *cib_last = NULL;
    xmlNode *update = get_message_xml(msg, F_CIB_UPDATE);

    if (msg == NULL) {
        crm_err("NULL update");
        return;
    }

    crm_element_value_int(msg, F_CIB_RC, &rc);
    op = crm_element_value(msg, F_CIB_OPERATION);
    diff = get_message_xml(msg, F_CIB_UPDATE_RESULT);

    if (rc < pcmk_ok) {
        log_level = LOG_WARNING;
        do_crm_log(log_level, "[%s] %s ABORTED: %s", event, op, pcmk_strerror(rc));
        return;
    }

    if (log_diffs) {
        xml_log_patchset(log_level, op, diff);
    }

    if (log_updates && update != NULL) {
        crm_log_xml_trace(update, "raw_update");
    }

    if (cib_copy != NULL) {
        cib_last = cib_copy;
        cib_copy = NULL;
        rc = cib_process_diff(op, cib_force_diff, NULL, NULL, diff, cib_last, &cib_copy, NULL);

        if (rc != pcmk_ok) {
            crm_debug("Update didn't apply, requesting full copy: %s", pcmk_strerror(rc));
            free_xml(cib_copy);
            cib_copy = NULL;
        }
    }

    if (cib_copy == NULL) {
        rc = cib->cmds->query(cib, NULL, &cib_copy, cib_scope_local | cib_sync_call);
    }

    if(rc == -EACCES) {
        crm_exit(CRM_EX_INSUFFICIENT_PRIV);
    }

    free_xml(cib_last);
}
开发者ID:miz-take,项目名称:pacemaker,代码行数:56,代码来源:cibmon.c

示例13: log_date

void
log_date(int log_level, const char *prefix, ha_time_t * date_time, int flags)
{
    char *date_s = date_to_string(date_time, flags);

    do_crm_log(log_level, "%s%s%s",
               prefix ? prefix : "", prefix ? ": " : "", date_s ? date_s : "__invalid_date__");

    crm_free(date_s);
}
开发者ID:smellman,项目名称:pacemaker,代码行数:10,代码来源:iso8601.c

示例14: crm_dump_peer_hash

static void crm_dump_peer_hash(int level, const char *caller)
{
    GHashTableIter iter;
    const char *id = NULL;
    crm_node_t *node = NULL;

    g_hash_table_iter_init(&iter, crm_peer_cache);
    while (g_hash_table_iter_next(&iter, (gpointer *) &id, (gpointer *) &node)) {
        do_crm_log(level, "%s: Node %u/%s = %p - %s", caller, node->id, node->uname, node, id);
    }
}
开发者ID:vishnumitraha,项目名称:pacemaker,代码行数:11,代码来源:membership.c

示例15: crmd_join_phase_log

void crmd_join_phase_log(int level)
{
    crm_node_t *peer;
    GHashTableIter iter;

    g_hash_table_iter_init(&iter, crm_peer_cache);
    while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &peer)) {
        do_crm_log(level, "join-%d: %s=%s", current_join_id, peer->uname,
                   crm_join_phase_str(peer->join));
    }
}
开发者ID:beekhof,项目名称:pacemaker,代码行数:11,代码来源:join_dc.c


注:本文中的do_crm_log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。