errant fixes running sp backup cli (#1589)

## Type of change

- [x] 🐹 Trivial/Minor

## Issue(s)

* #1506

## Test Plan

- [x] 💪 Manual
This commit is contained in:
Keepers 2022-11-23 09:50:39 -07:00 committed by GitHub
parent 48e3855847
commit 22ff7f5d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 5 deletions

View File

@ -281,6 +281,8 @@ func getStreamItemFunc(
ctx, end := D.Span(ctx, "kopia:getStreamItemFunc")
defer end()
log := logger.Ctx(ctx)
// Collect all errors and return them at the end so that iteration for this
// directory doesn't end early.
var errs *multierror.Error
@ -314,11 +316,12 @@ func getStreamItemFunc(
err = errors.Wrap(err, "getting full item path")
errs = multierror.Append(errs, err)
logger.Ctx(ctx).Error(err)
log.Error(err)
continue
}
log.Debugw("reading item", "path", itemPath.String())
trace.Log(ctx, "kopia:getStreamItemFunc:item", itemPath.String())
ei, ok := e.(data.StreamInfo)
@ -326,8 +329,7 @@ func getStreamItemFunc(
errs = multierror.Append(
errs, errors.Errorf("item %q does not implement DataStreamInfo", itemPath))
logger.Ctx(ctx).Errorw(
"item does not implement DataStreamInfo; skipping", "path", itemPath)
log.Errorw("item does not implement DataStreamInfo; skipping", "path", itemPath)
continue
}

View File

@ -174,7 +174,7 @@ func MessageWithCompletion(message string) (chan<- struct{}, func()) {
mpb.SpinnerStyle(frames...).PositionLeft(),
mpb.PrependDecorators(
decor.Name(message),
decor.Elapsed(decor.ET_STYLE_GO, decor.WC{W: 4}),
decor.Elapsed(decor.ET_STYLE_GO, decor.WC{W: 8}),
),
mpb.BarFillerOnComplete("done"),
)

View File

@ -25,6 +25,7 @@ const (
Info
Warn
Production
Disabled
)
const logLevelFN = "log-level"
@ -80,6 +81,8 @@ func genLogger(level logLevel) (*zapcore.Core, *zap.SugaredLogger) {
return lvl >= zapcore.WarnLevel
case Production:
return lvl >= zapcore.ErrorLevel
case Disabled:
return false
default:
return true
}
@ -104,6 +107,8 @@ func genLogger(level logLevel) (*zapcore.Core, *zap.SugaredLogger) {
cfg.Level = zap.NewAtomicLevelAt(zapcore.InfoLevel)
case Warn:
cfg.Level = zap.NewAtomicLevelAt(zapcore.WarnLevel)
case Disabled:
cfg.Level = zap.NewAtomicLevelAt(zapcore.FatalLevel)
}
lgr, err = cfg.Build()
@ -191,6 +196,8 @@ func levelOf(lvl string) logLevel {
return Warn
case "error":
return Production
case "disabled":
return Disabled
}
return Info

View File

@ -58,7 +58,7 @@ const (
)
var (
delimiter = fmt.Sprint(0x1F)
delimiter = string('\x1F')
passAny = filters.Pass()
failAny = filters.Fail()
)