mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
virlog: Introduce virLogSetFilters
This method will eventually replace virLogParseAndDefineFilters which currently does both parsing and defining. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
6db7b8cbb5
commit
c33babfe31
@ -1898,6 +1898,7 @@ virLogPriorityFromSyslog;
|
|||||||
virLogProbablyLogMessage;
|
virLogProbablyLogMessage;
|
||||||
virLogReset;
|
virLogReset;
|
||||||
virLogSetDefaultPriority;
|
virLogSetDefaultPriority;
|
||||||
|
virLogSetFilters;
|
||||||
virLogSetFromEnv;
|
virLogSetFromEnv;
|
||||||
virLogSetOutputs;
|
virLogSetOutputs;
|
||||||
virLogUnlock;
|
virLogUnlock;
|
||||||
|
@ -2180,3 +2180,35 @@ virLogSetOutputs(const char *src)
|
|||||||
virLogOutputListFree(outputs, noutputs);
|
virLogOutputListFree(outputs, noutputs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virLogSetFilters:
|
||||||
|
* @src: string defining a (set of) filter(s)
|
||||||
|
*
|
||||||
|
* Replaces the current set of defined filters with a new set of filters.
|
||||||
|
*
|
||||||
|
* Returns 0 on success or -1 in case of an error.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virLogSetFilters(const char *src)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
int nfilters = 0;
|
||||||
|
virLogFilterPtr *filters = NULL;
|
||||||
|
|
||||||
|
if (virLogInitialize() < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (src && (nfilters = virLogParseFilters(src, &filters)) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virLogDefineFilters(filters, nfilters) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
filters = NULL;
|
||||||
|
ret = 0;
|
||||||
|
cleanup:
|
||||||
|
virLogFilterListFree(filters, nfilters);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -198,6 +198,7 @@ void virLogOutputListFree(virLogOutputPtr *list, int count);
|
|||||||
void virLogFilterFree(virLogFilterPtr filter);
|
void virLogFilterFree(virLogFilterPtr filter);
|
||||||
void virLogFilterListFree(virLogFilterPtr *list, int count);
|
void virLogFilterListFree(virLogFilterPtr *list, int count);
|
||||||
int virLogSetOutputs(const char *outputs) ATTRIBUTE_NONNULL(1);
|
int virLogSetOutputs(const char *outputs) ATTRIBUTE_NONNULL(1);
|
||||||
|
int virLogSetFilters(const char *filters);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal logging API
|
* Internal logging API
|
||||||
|
Loading…
Reference in New Issue
Block a user