mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +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
|
# util/virlog.h
|
||||||
virLogDefineFilter;
|
virLogDefineFilter;
|
||||||
|
virLogDefineFilters;
|
||||||
virLogDefineOutput;
|
virLogDefineOutput;
|
||||||
virLogDefineOutputs;
|
virLogDefineOutputs;
|
||||||
virLogFilterFree;
|
virLogFilterFree;
|
||||||
|
@ -1706,3 +1706,30 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
|
|||||||
|
|
||||||
return 0;
|
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);
|
virLogDestination dest, const void *opaque);
|
||||||
int virLogDefineOutputs(virLogOutputPtr *outputs,
|
int virLogDefineOutputs(virLogOutputPtr *outputs,
|
||||||
size_t noutputs) ATTRIBUTE_NONNULL(1);
|
size_t noutputs) ATTRIBUTE_NONNULL(1);
|
||||||
|
int virLogDefineFilters(virLogFilterPtr *filters, size_t nfilters);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user