MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / log_data_element

Function log_data_element

lib/common/xml.c:997–1114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995}
996
997int
998log_data_element(
999 int log_level, const char *file, const char *function, int line,
1000 const char *prefix, xmlNode *data, int depth, int options)
1001{
1002 xmlNode *a_child = NULL;
1003
1004 int offset = 0;
1005 int printed = 0;
1006 char *buffer = NULL;
1007 char *prefix_m = NULL;
1008 int buffer_len = 1000;
1009
1010 xmlAttrPtr pIter = NULL;
1011 const char *name = NULL;
1012 const char *hidden = NULL;
1013
1014 /* Since we use the same file and line, to avoid confusing libqb, we need to use the same format strings */
1015 if(data == NULL) {
1016 do_crm_log_alias(log_level, file, function, line, "%s%s", prefix, ": No data to dump as XML");
1017 return 0;
1018 }
1019
1020 if(prefix == NULL) {
1021 prefix = "";
1022 }
1023
1024 name = crm_element_name(data);
1025 CRM_ASSERT(name != NULL);
1026
1027 /* crm_trace("Dumping %s", name); */
1028 buffer = calloc(1, buffer_len);
1029
1030 if(is_set(options, xml_log_option_formatted)) {
1031 offset = print_spaces(buffer, depth, buffer_len - offset);
1032 if(is_set(options, xml_log_option_diff_plus) && (data->children == NULL || crm_element_value(data, XML_DIFF_MARKER))) {
1033 options |= xml_log_option_diff_all;
1034 prefix_m = strdup(prefix);
1035 prefix_m[1] = '+';
1036 prefix = prefix_m;
1037
1038 } else if(is_set(options, xml_log_option_diff_minus) && (data->children == NULL || crm_element_value(data, XML_DIFF_MARKER))) {
1039 options |= xml_log_option_diff_all;
1040 prefix_m = strdup(prefix);
1041 prefix_m[1] = '-';
1042 prefix = prefix_m;
1043 }
1044 }
1045
1046 if(is_set(options, xml_log_option_diff_short) && is_not_set(options, xml_log_option_diff_all)) {
1047 /* Still searching for the actual change */
1048 for(a_child = __xml_first_child(data); a_child != NULL; a_child = __xml_next(a_child)) {
1049 log_data_element(
1050 log_level, file, function, line, prefix, a_child, depth+1, options);
1051 }
1052 goto done;
1053 }
1054

Callers 1

log_xml_diffFunction · 0.85

Calls 9

is_setFunction · 0.85
print_spacesFunction · 0.85
crm_element_valueFunction · 0.85
is_not_setFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
crm_first_attrFunction · 0.85
crm_attr_valueFunction · 0.85
xml_has_childrenFunction · 0.85

Tested by

no test coverage detected