mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
virlog: Introduce virLogSetOutputs
This API is the entry point to output modification of the logger. Currently, everything is done by virLogParseAndDefineOutputs. Parsing and defining will be split into two operations both handled by this method transparently. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
09d7ced8ee
commit
6db7b8cbb5
@ -1899,6 +1899,7 @@ virLogProbablyLogMessage;
|
||||
virLogReset;
|
||||
virLogSetDefaultPriority;
|
||||
virLogSetFromEnv;
|
||||
virLogSetOutputs;
|
||||
virLogUnlock;
|
||||
virLogVMessage;
|
||||
|
||||
|
@ -2149,3 +2149,34 @@ virLogParseFilters(const char *src, virLogFilterPtr **filters)
|
||||
virStringFreeList(strings);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* virLogSetOutputs:
|
||||
* @outputs: string defining a (set of) output(s)
|
||||
*
|
||||
* Replaces the current set of defined outputs with a new set of outputs.
|
||||
*
|
||||
* Returns 0 on success or -1 in case of an error.
|
||||
*/
|
||||
int
|
||||
virLogSetOutputs(const char *src)
|
||||
{
|
||||
int ret = -1;
|
||||
int noutputs = 0;
|
||||
virLogOutputPtr *outputs = NULL;
|
||||
|
||||
if (virLogInitialize() < 0)
|
||||
return -1;
|
||||
|
||||
if ((noutputs = virLogParseOutputs(src, &outputs)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virLogDefineOutputs(outputs, noutputs) < 0)
|
||||
goto cleanup;
|
||||
|
||||
outputs = NULL;
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virLogOutputListFree(outputs, noutputs);
|
||||
return ret;
|
||||
}
|
||||
|
@ -197,6 +197,7 @@ void virLogOutputFree(virLogOutputPtr output);
|
||||
void virLogOutputListFree(virLogOutputPtr *list, int count);
|
||||
void virLogFilterFree(virLogFilterPtr filter);
|
||||
void virLogFilterListFree(virLogFilterPtr *list, int count);
|
||||
int virLogSetOutputs(const char *outputs) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/*
|
||||
* Internal logging API
|
||||
|
Loading…
x
Reference in New Issue
Block a user