提交 58ab1b6f 编写于 作者: E Erik Skultety

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: NErik Skultety <eskultet@redhat.com>
上级 d9d6b61f
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册