Make the libvirt trace compact: libvirt API names, one error field, terse test output

The first live run showed the trace working but noisy: testr printed
ts/level/msg and the per-run constants on every line, the error text
appeared twice, host appeared twice on image-cache lines, and the Go
method name was less useful than the libvirt function it maps to.

The tracer now logs rpc=virDomainLookupByName (go-libvirt's names are the
public API names without the vir prefix), error plus libvirtError (code
name) and libvirtCode, and image.go stops re-adding host. The integration
test replaces testr with a compact logr sink: time, logger name, the rpc
as headline, then fields, with provider/host/name omitted since the first
line of the run states them. Docs and execution log updated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-10 19:13:51 +00:00
co-authored by Claude Fable 5.1
parent f50d30e58e
commit 5a6c889531
11 changed files with 165 additions and 46 deletions
+9 -9
View File
@@ -925,15 +925,15 @@ func TestLogging_verbosityTiers(t *testing.T) {
wantLines: []string{
`kvm/libvirt "level"=1 "msg"="libvirt host connected"`,
`"msg"="libvirt call"`,
`"method"="DomainLookupByName"`,
`"libvirtCodeName"="ErrNoDomain"`,
`"method"="StorageVolUpload"`,
`"method"="DomainDefineXML"`,
`"method"="DomainCreate"`,
`"method"="DomainInterfaceAddresses"`,
`"method"="ConnectListAllDomains"`,
`"method"="DomainUndefineFlags"`,
`"method"="StorageVolDelete"`,
`"rpc"="virDomainLookupByName"`,
`"libvirtError"="ErrNoDomain"`,
`"rpc"="virStorageVolUpload"`,
`"rpc"="virDomainDefineXML"`,
`"rpc"="virDomainCreate"`,
`"rpc"="virDomainInterfaceAddresses"`,
`"rpc"="virConnectListAllDomains"`,
`"rpc"="virDomainUndefineFlags"`,
`"rpc"="virStorageVolDelete"`,
`"provider"="kvm-home"`,
`"host"="nas1"`,
`"name"="` + testName + `"`,