pkg/logging: Remove unneeded argument

This commit is contained in:
Tom Wiesing 2023-03-13 13:24:19 +01:00
parent d7847b5d69
commit 2493cbb078
No known key found for this signature in database
15 changed files with 75 additions and 76 deletions

View file

@ -64,7 +64,7 @@ func (exporter *Exporter) NewBackup(ctx context.Context, progress io.Writer, des
backup.EndTime = time.Now().UTC()
return nil
}, progress, ctx, "Writing backup files")
}, progress, "Writing backup files")
return
}
@ -109,7 +109,7 @@ func (backup *Backup) run(ctx context.Context, progress io.Writer, exporter *Exp
}
return nil
}, progress, ctx, "Backing up core components")
}, progress, "Backing up core components")
// backup instances
logging.LogOperation(func() error {
@ -164,6 +164,6 @@ func (backup *Backup) run(ctx context.Context, progress io.Writer, exporter *Exp
})
return nil
}, progress, ctx, "Creating instance snapshots")
}, progress, "Creating instance snapshots")
}

View file

@ -56,7 +56,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
}
// determine target paths
logging.LogMessage(progress, ctx, "Determining target paths")
logging.LogMessage(progress, "Determining target paths")
var stagingDir, archivePath string
if task.StagingOnly {
stagingDir = task.Dest
@ -76,7 +76,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
fmt.Fprintf(progress, "Archive Path: %s\n", archivePath)
// create the staging directory
logging.LogMessage(progress, ctx, "Creating staging directory")
logging.LogMessage(progress, "Creating staging directory")
err = fsx.Mkdir(stagingDir, fsx.DefaultDirPerm)
if !errors.Is(err, fs.ErrExist) && err != nil {
return err
@ -86,7 +86,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
// we need the staging directory to be deleted at the end
if !task.StagingOnly {
defer func() {
logging.LogMessage(progress, ctx, "Removing staging directory")
logging.LogMessage(progress, "Removing staging directory")
os.RemoveAll(stagingDir)
}()
}
@ -125,7 +125,7 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
_, err := sl.Report(report)
return err
}
}, progress, ctx, "Generating %s", Title)
}, progress, "Generating %s", Title)
// if we only requested staging
// all that is left is to write the log entry
@ -155,12 +155,12 @@ func (exporter *Exporter) MakeExport(ctx context.Context, progress io.Writer, ta
})
return err
}, progress, ctx, "Writing archive"); err != nil {
}, progress, "Writing archive"); err != nil {
return err
}
// write out the log entry
logging.LogMessage(progress, ctx, "Writing Log Entry")
logging.LogMessage(progress, "Writing Log Entry")
entry.Path = archivePath
entry.Packed = true
exporter.Dependencies.ExporterLogger.Add(ctx, entry)

View file

@ -46,7 +46,7 @@ type Snapshot struct {
// Snapshot creates a new snapshot of this instance into dest
func (snapshots *Exporter) NewSnapshot(ctx context.Context, instance *wisski.WissKI, progress io.Writer, desc SnapshotDescription) (snapshot Snapshot) {
logging.LogMessage(progress, ctx, "Locking instance")
logging.LogMessage(progress, "Locking instance")
if !instance.Locker().TryLock(ctx) {
err := locker.Locked
fmt.Fprintln(progress, err)
@ -57,7 +57,7 @@ func (snapshots *Exporter) NewSnapshot(ctx context.Context, instance *wisski.Wis
}
}
defer func() {
logging.LogMessage(progress, ctx, "Unlocking instance")
logging.LogMessage(progress, "Unlocking instance")
instance.Locker().Unlock(ctx)
}()
@ -79,7 +79,7 @@ func (snapshots *Exporter) NewSnapshot(ctx context.Context, instance *wisski.Wis
snapshot.EndTime = time.Now().UTC()
return nil
}, progress, ctx, "Writing snapshot files")
}, progress, "Writing snapshot files")
slices.Sort(snapshot.Manifest)
return
@ -89,11 +89,11 @@ func (snapshot *Snapshot) makeParts(ctx context.Context, progress io.Writer, sna
if !needsRunning && !snapshot.Description.Keepalive {
stack := instance.Barrel().Stack()
logging.LogMessage(progress, ctx, "Stopping instance")
logging.LogMessage(progress, "Stopping instance")
snapshot.ErrStop = stack.Down(ctx, progress)
defer func() {
logging.LogMessage(progress, ctx, "Starting instance")
logging.LogMessage(progress, "Starting instance")
snapshot.ErrStart = stack.Up(ctx, progress)
}()
}