mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
virlog: Introduce virLogDefineFilters
Prepare a method that only defines a set of filters. It takes a list of filters, preferably created by virLogParseFilters. The original set of filters is reset and replaced by the new user-provided set of filters. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
d9d6b61f6d
commit
58ab1b6f89
@ -1870,6 +1870,7 @@ virLockSpaceReleaseResourcesForOwner;
|
||||
|
||||
# util/virlog.h
|
||||
virLogDefineFilter;
|
||||
virLogDefineFilters;
|
||||
virLogDefineOutput;
|
||||
virLogDefineOutputs;
|
||||
virLogFilterFree;
|
||||
|
@ -1706,3 +1706,30 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virLogDefineFilters:
|
||||
* @filters: new set of filters to be defined
|
||||
* @nfilters: number of filters in @filters
|
||||
*
|
||||
* Resets any existing set of filters and defines a completely new one. The
|
||||
* resulting set can also be empty in which case NULL should be passed to
|
||||
* @filters.
|
||||
*
|
||||
* Returns 0 on success or -1 in case of error.
|
||||
*/
|
||||
int
|
||||
virLogDefineFilters(virLogFilterPtr *filters, size_t nfilters)
|
||||
{
|
||||
if (virLogInitialize() < 0)
|
||||
return -1;
|
||||
|
||||
virLogLock();
|
||||
virLogResetFilters();
|
||||
virLogFilters = filters;
|
||||
virLogNbFilters = nfilters;
|
||||
virLogUnlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -239,5 +239,6 @@ int virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
|
||||
virLogDestination dest, const void *opaque);
|
||||
int virLogDefineOutputs(virLogOutputPtr *outputs,
|
||||
size_t noutputs) ATTRIBUTE_NONNULL(1);
|
||||
int virLogDefineFilters(virLogFilterPtr *filters, size_t nfilters);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user