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

View File

@ -174,7 +174,7 @@ func MessageWithCompletion(message string) (chan<- struct{}, func()) {
mpb.SpinnerStyle(frames...).PositionLeft(), mpb.SpinnerStyle(frames...).PositionLeft(),
mpb.PrependDecorators( mpb.PrependDecorators(
decor.Name(message), 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"), mpb.BarFillerOnComplete("done"),
) )

View File

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

View File

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