Skip to content

Commit

Permalink
update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Jan 22, 2025
1 parent 6ac3eda commit b4a6c68
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion autopilot/contractor/contractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ func performContractChecks(ctx *mCtx, alerter alerts.Alerter, s Database, churn

// check usability
if !host.Checks.UsabilityBreakdown.IsUsable() {
logger.Info("unusable host")
logger.Debug("unusable host")
updateUsability(ctx, host, cm, api.ContractUsabilityBad, host.Checks.UsabilityBreakdown.String())
continue
}
Expand Down
2 changes: 1 addition & 1 deletion autopilot/contractor/hostset.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (hs *hostSet) HasRedundantIP(ctx context.Context, host api.Host) bool {
// the scanning code will lead to the host being marked as offline.
resolvedAddresses, err := hs.resolveHostIP(ctx, host)
if err != nil {
logger.With(zap.Error(err)).Error("failed to resolve host ips - not redundant")
logger.With(zap.Error(err)).Warn("failed to resolve host ips - not redundant")
return false
}

Expand Down
6 changes: 4 additions & 2 deletions autopilot/pruner/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ func (p *Pruner) performContractPruning(ctx context.Context) {
}

// log total pruned
log.Info(fmt.Sprintf("pruned %d (%s) from %v contracts", total, humanReadableSize(int(total)), len(prunable)))
if total > 0 {
log.Info(fmt.Sprintf("pruned %d (%s) from %v contracts", total, humanReadableSize(int(total)), len(prunable)))
}
}

func (p *Pruner) pruneContract(ctx context.Context, fcid types.FileContractID, hk types.PublicKey, hostVersion, hostRelease string, logger *zap.SugaredLogger) (uint64, error) {
Expand Down Expand Up @@ -274,7 +276,7 @@ func (p *Pruner) pruneContract(ctx context.Context, fcid types.FileContractID, h
// handle logs
if res.Error != "" {
log.Errorw("unexpected error interrupted pruning", zap.Error(errors.New(res.Error)))
} else {
} else if res.Pruned > 0 {
log.Info("successfully pruned contract")
}

Expand Down
4 changes: 2 additions & 2 deletions bus/scanning.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ func (b *Bus) scanHostV1(ctx context.Context, timeout time.Duration, hostKey typ

logger = logger.With("elapsed", duration).With(zap.Error(err))
if err == nil {
logger.Info("successfully scanned host on second try")
logger.Debug("successfully scanned host on second try")
} else if !isErrHostUnreachable(err) {
logger.Infow("failed to scan host")
logger.Debugw("failed to scan host")
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func (a *Manager) refillAccounts() {
a.mu.Unlock()

if err != nil && shouldLog {
a.logger.Errorw("failed to refill account for host", zap.Stringer("hostKey", contract.HostKey), zap.Error(err))
a.logger.Warnw("failed to refill account for host", zap.Stringer("hostKey", contract.HostKey), zap.Error(err))
} else if refilled {
a.logger.Infow("successfully refilled account for host", zap.Stringer("hostKey", contract.HostKey), zap.Error(err))
}
Expand Down Expand Up @@ -623,7 +623,7 @@ func (a *Account) setBalance(balance *big.Int) {
a.acc.RequiresSync = false

// log account changes
a.logger.Infow("account balance was reset",
a.logger.Debugw("account balance was reset",
zap.Stringer("account", a.acc.ID),
zap.Stringer("host", a.acc.HostKey),
zap.Stringer("balanceBefore", prevBalance),
Expand Down

0 comments on commit b4a6c68

Please sign in to comment.