fix: restore removed log.Info messages and add info-level logging at key milestones

Restore four log.Info messages removed during refactor in verify.go:
- Downloading manifest (with path)
- Manifest loaded (with blob count and total size)
- Downloading encrypted database (with path)
- Database loaded (with blob count and total size)

Also replaced IIFE for totalSize computation with a local variable.

Add info-level logging at key operational milestones:
- info.go: log start and completion of remote info gathering
- snapshot.go: log snapshot completion with key stats
- snapshot.go: log start of ListSnapshots operation
This commit is contained in:
user
2026-03-13 17:33:18 -07:00
parent 1fe250d8b2
commit 99516a03cf
3 changed files with 31 additions and 8 deletions

View File

@@ -149,6 +149,7 @@ type RemoteInfoResult struct {
// RemoteInfo displays information about remote storage // RemoteInfo displays information about remote storage
func (v *Vaultik) RemoteInfo(jsonOutput bool) error { func (v *Vaultik) RemoteInfo(jsonOutput bool) error {
log.Info("Starting remote storage info gathering")
result := &RemoteInfoResult{} result := &RemoteInfoResult{}
storageInfo := v.Storage.Info() storageInfo := v.Storage.Info()
@@ -180,6 +181,12 @@ func (v *Vaultik) RemoteInfo(jsonOutput bool) error {
return err return err
} }
log.Info("Remote info complete",
"snapshots", result.TotalMetadataCount,
"total_blobs", result.TotalBlobCount,
"referenced_blobs", result.ReferencedBlobCount,
"orphaned_blobs", result.OrphanedBlobCount)
if jsonOutput { if jsonOutput {
enc := json.NewEncoder(v.Stdout) enc := json.NewEncoder(v.Stdout)
enc.SetIndent("", " ") enc.SetIndent("", " ")

View File

@@ -164,6 +164,14 @@ func (v *Vaultik) createNamedSnapshot(opts *SnapshotCreateOptions, hostname, sna
return err return err
} }
log.Info("Snapshot complete",
"snapshot_id", snapshotID,
"name", snapName,
"files", stats.totalFiles,
"blobs_uploaded", stats.totalBlobsUploaded,
"bytes_uploaded", stats.totalBytesUploaded,
"duration", time.Since(snapshotStartTime))
v.printSnapshotSummary(snapshotID, snapshotStartTime, stats) v.printSnapshotSummary(snapshotID, snapshotStartTime, stats)
return nil return nil
} }
@@ -359,6 +367,7 @@ func (v *Vaultik) getSnapshotBlobSizes(snapshotID string) (compressed int64, unc
// ListSnapshots lists all snapshots // ListSnapshots lists all snapshots
func (v *Vaultik) ListSnapshots(jsonOutput bool) error { func (v *Vaultik) ListSnapshots(jsonOutput bool) error {
log.Info("Listing snapshots")
remoteSnapshots, err := v.listRemoteSnapshotIDs() remoteSnapshots, err := v.listRemoteSnapshotIDs()
if err != nil { if err != nil {
return err return err

View File

@@ -107,10 +107,11 @@ func (v *Vaultik) RunDeepVerify(snapshotID string, opts *VerifyOptions) error {
// loadVerificationData downloads manifest, database, and blob list for verification // loadVerificationData downloads manifest, database, and blob list for verification
func (v *Vaultik) loadVerificationData(snapshotID string, opts *VerifyOptions, result *VerifyResult) (*snapshot.Manifest, *tempDB, []snapshot.BlobInfo, error) { func (v *Vaultik) loadVerificationData(snapshotID string, opts *VerifyOptions, result *VerifyResult) (*snapshot.Manifest, *tempDB, []snapshot.BlobInfo, error) {
// Download manifest // Download manifest
manifestPath := fmt.Sprintf("metadata/%s/manifest.json.zst", snapshotID)
log.Info("Downloading manifest", "path", manifestPath)
if !opts.JSON { if !opts.JSON {
v.printfStdout("Downloading manifest...\n") v.printfStdout("Downloading manifest...\n")
} }
manifestPath := fmt.Sprintf("metadata/%s/manifest.json.zst", snapshotID)
manifestReader, err := v.Storage.Get(v.ctx, manifestPath) manifestReader, err := v.Storage.Get(v.ctx, manifestPath)
if err != nil { if err != nil {
return nil, nil, nil, v.deepVerifyFailure(result, opts, return nil, nil, nil, v.deepVerifyFailure(result, opts,
@@ -126,6 +127,9 @@ func (v *Vaultik) loadVerificationData(snapshotID string, opts *VerifyOptions, r
fmt.Errorf("failed to decode manifest: %w", err)) fmt.Errorf("failed to decode manifest: %w", err))
} }
log.Info("Manifest loaded",
"manifest_blob_count", manifest.BlobCount,
"manifest_total_size", humanize.Bytes(uint64(manifest.TotalCompressedSize)))
if !opts.JSON { if !opts.JSON {
v.printfStdout("Manifest loaded: %d blobs (%s)\n", manifest.BlobCount, humanize.Bytes(uint64(manifest.TotalCompressedSize))) v.printfStdout("Manifest loaded: %d blobs (%s)\n", manifest.BlobCount, humanize.Bytes(uint64(manifest.TotalCompressedSize)))
v.printfStdout("Downloading and decrypting database...\n") v.printfStdout("Downloading and decrypting database...\n")
@@ -133,6 +137,7 @@ func (v *Vaultik) loadVerificationData(snapshotID string, opts *VerifyOptions, r
// Download and decrypt database // Download and decrypt database
dbPath := fmt.Sprintf("metadata/%s/db.zst.age", snapshotID) dbPath := fmt.Sprintf("metadata/%s/db.zst.age", snapshotID)
log.Info("Downloading encrypted database", "path", dbPath)
dbReader, err := v.Storage.Get(v.ctx, dbPath) dbReader, err := v.Storage.Get(v.ctx, dbPath)
if err != nil { if err != nil {
return nil, nil, nil, v.deepVerifyFailure(result, opts, return nil, nil, nil, v.deepVerifyFailure(result, opts,
@@ -156,14 +161,16 @@ func (v *Vaultik) loadVerificationData(snapshotID string, opts *VerifyOptions, r
fmt.Errorf("failed to get blobs from database: %w", err)) fmt.Errorf("failed to get blobs from database: %w", err))
} }
if !opts.JSON { var dbTotalSize int64
v.printfStdout("Database loaded: %d blobs (%s)\n", len(dbBlobs), humanize.Bytes(uint64(func() int64 {
var s int64
for _, b := range dbBlobs { for _, b := range dbBlobs {
s += b.CompressedSize dbTotalSize += b.CompressedSize
} }
return s
}()))) log.Info("Database loaded",
"db_blob_count", len(dbBlobs),
"db_total_size", humanize.Bytes(uint64(dbTotalSize)))
if !opts.JSON {
v.printfStdout("Database loaded: %d blobs (%s)\n", len(dbBlobs), humanize.Bytes(uint64(dbTotalSize)))
} }
return manifest, tdb, dbBlobs, nil return manifest, tdb, dbBlobs, nil