root/crmd/misc.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. do_log

   1 /*
   2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   3  *
   4  * This program is free software; you can redistribute it and/or
   5  * modify it under the terms of the GNU General Public
   6  * License as published by the Free Software Foundation; either
   7  * version 2 of the License, or (at your option) any later version.
   8  *
   9  * This software is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12  * General Public License for more details.
  13  *
  14  * You should have received a copy of the GNU General Public
  15  * License along with this library; if not, write to the Free Software
  16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17  */
  18 #include <crm_internal.h>
  19 
  20 #include <crm/crm.h>
  21 #include <crm/cib.h>
  22 #include <crm/msg_xml.h>
  23 #include <crm/common/xml.h>
  24 
  25 #include <crmd_fsa.h>
  26 #include <crmd_messages.h>
  27 
  28 /*      A_LOG, A_WARN, A_ERROR  */
  29 void
  30 do_log(long long action,
     /* [previous][next][first][last][top][bottom][index][help] */
  31        enum crmd_fsa_cause cause,
  32        enum crmd_fsa_state cur_state, enum crmd_fsa_input current_input, fsa_data_t * msg_data)
  33 {
  34     unsigned log_type = LOG_TRACE;
  35 
  36     if (action & A_LOG) {
  37         log_type = LOG_INFO;
  38     } else if (action & A_WARN) {
  39         log_type = LOG_WARNING;
  40     } else if (action & A_ERROR) {
  41         log_type = LOG_ERR;
  42     }
  43 
  44     do_crm_log(log_type, "Input %s received in state %s from %s",
  45                fsa_input2string(msg_data->fsa_input),
  46                fsa_state2string(cur_state), msg_data->origin);
  47 
  48     if (msg_data->data_type == fsa_dt_ha_msg) {
  49         ha_msg_input_t *input = fsa_typed_data(msg_data->data_type);
  50 
  51         crm_log_xml_debug(input->msg, __FUNCTION__);
  52 
  53     } else if (msg_data->data_type == fsa_dt_xml) {
  54         xmlNode *input = fsa_typed_data(msg_data->data_type);
  55 
  56         crm_log_xml_debug(input, __FUNCTION__);
  57 
  58     } else if (msg_data->data_type == fsa_dt_lrm) {
  59         lrmd_event_data_t *input = fsa_typed_data(msg_data->data_type);
  60 
  61         do_crm_log(log_type,
  62                    "Resource %s: Call ID %d returned %d (%d)."
  63                    "  New status if rc=0: %s",
  64                    input->rsc_id, input->call_id, input->rc,
  65                    input->op_status, (char *)input->user_data);
  66     }
  67 }

/* [previous][next][first][last][top][bottom][index][help] */