Refine logging infrastructure.

1) Make logging conditional on debug flags.

2) Add command line option for setting these flags.

3) Emit warnings with g_warning() instead of g_message().

4) Added note about how FX_LIB_LEVEL_MAX[1-3] is used.
This commit is contained in:
Tim LaBerge
2012-02-27 20:26:42 -08:00
parent 9fcf6939d0
commit a073f5cde2
6 changed files with 183 additions and 62 deletions

View File

@@ -57,11 +57,12 @@ map_xml_value(XmlSettings *xml, gint value)
switch (xml->values->type) {
case VALUE_TYPE_LABEL:
if ((xml->values == &values_on_off) && (value > 1)) {
g_message("Skipping modifier->label %s\n", xml->label);
g_warning("Skipping modifier->label %s\n", xml->label);
return NULL;
}
if (value > xml->values->max || value < xml->values->min) {
g_message("%s value %d out of range %0.1f %0.1f", xml->label, value, xml->values->min, xml->values->max);
g_warning("%s value %d out of range %0.1f %0.1f",
xml->label, value, xml->values->min, xml->values->max);
}
{
XmlLabel *labels = xml->xml_labels;
@@ -142,7 +143,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
SettingParam *param = (SettingParam *) iter_params->data;
if (param->id == last_id && param->position == last_position) {
g_message("Skipping duplicate parameter id %d position %d",
g_warning("Skipping duplicate parameter id %d position %d",
last_id, last_position);
iter_params = iter_params->next;
continue;
@@ -206,8 +207,9 @@ write_preset_to_xml(Preset *preset, gchar *filename)
{
char *textp = map_xml_value(xml, param->value);
if (!textp) {
g_message("Unable to map %s value %d for id %d position %d",
xml->label, param->value, param->id, param->position);
g_warning("Unable to map %s value %d for id %d position %d",
xml->label, param->value, param->id,
param->position);
textp = "";
}
rc = xmlTextWriterWriteElement(writer, BAD_CAST "Text",
@@ -235,7 +237,7 @@ write_preset_to_xml(Preset *preset, gchar *filename)
break;
default:
g_message("Unhandled value type %d", type);
g_warning("Unhandled value type %d", type);
break;
}
}