mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
virlog: Introduce virLogDefineOutputs
Prepare a method that only defines a set of outputs. It takes a list of outputs, preferably created by virLogParseOutputs. The original set of outputs is reset and replaced by the new user-provided set of outputs. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
b5004b09f5
commit
d9d6b61f6d
@ -1871,6 +1871,7 @@ virLockSpaceReleaseResourcesForOwner;
|
||||
# util/virlog.h
|
||||
virLogDefineFilter;
|
||||
virLogDefineOutput;
|
||||
virLogDefineOutputs;
|
||||
virLogFilterFree;
|
||||
virLogFilterListFree;
|
||||
virLogFilterNew;
|
||||
|
@ -1681,3 +1681,28 @@ virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virLogDefineOutputs:
|
||||
* @outputs: new set of outputs to be defined
|
||||
* @noutputs: number of outputs in @outputs
|
||||
*
|
||||
* Resets any existing set of outputs and defines a completely new one.
|
||||
*
|
||||
* Returns number of outputs successfully defined or -1 in case of error;
|
||||
*/
|
||||
int
|
||||
virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
|
||||
{
|
||||
if (virLogInitialize() < 0)
|
||||
return -1;
|
||||
|
||||
virLogLock();
|
||||
virLogResetOutputs();
|
||||
virLogOutputs = outputs;
|
||||
virLogNbOutputs = noutputs;
|
||||
virLogUnlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -237,5 +237,7 @@ virLogFilterPtr virLogFilterNew(const char *match,
|
||||
unsigned int flags) ATTRIBUTE_NONNULL(1);
|
||||
int virLogFindOutput(virLogOutputPtr *outputs, size_t noutputs,
|
||||
virLogDestination dest, const void *opaque);
|
||||
int virLogDefineOutputs(virLogOutputPtr *outputs,
|
||||
size_t noutputs) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user