Update everything expect transfers & sftp to not use zap

This commit is contained in:
Dane Everitt
2020-06-13 10:40:26 -07:00
parent 65b1b96b06
commit 7d4a8d7f7e
9 changed files with 40 additions and 46 deletions

View File

@@ -3,9 +3,9 @@ package backup
import (
"archive/tar"
"context"
"github.com/apex/log"
gzip "github.com/klauspost/pgzip"
"github.com/remeh/sizedwaitgroup"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"io"
"os"
@@ -67,7 +67,7 @@ func (a *Archive) Create(dest string, ctx context.Context) error {
// Attempt to remove the archive if there is an error, report that error to
// the logger if it fails.
if rerr := os.Remove(dest); rerr != nil && !os.IsNotExist(rerr) {
zap.S().Warnw("failed to delete corrupted backup archive", zap.String("location", dest))
log.WithField("location", dest).Warn("failed to delete corrupted backup archive")
}
return err

View File

@@ -3,10 +3,10 @@ package backup
import (
"crypto/sha256"
"encoding/hex"
"github.com/apex/log"
"github.com/pkg/errors"
"github.com/pterodactyl/wings/api"
"github.com/pterodactyl/wings/config"
"go.uber.org/zap"
"io"
"os"
"path"
@@ -121,7 +121,10 @@ func (b *Backup) Details() *ArchiveDetails {
resp, err := b.Checksum()
if err != nil {
zap.S().Errorw("failed to calculate checksum for backup", zap.String("backup", b.Uuid), zap.Error(err))
log.WithFields(log.Fields{
"backup": b.Identifier(),
"error": err,
}).Error("failed to calculate checksum for backup")
}
checksum = hex.EncodeToString(resp)

View File

@@ -3,7 +3,7 @@ package backup
import (
"context"
"fmt"
"go.uber.org/zap"
"github.com/apex/log"
"io"
"net/http"
"os"
@@ -76,8 +76,11 @@ func (s *S3Backup) generateRemoteRequest(rc io.ReadCloser) (*http.Response, erro
}
r.Body = rc
zap.S().Debugw("uploading backup to remote S3 endpoint", zap.String("endpoint", s.PresignedUrl), zap.Any("headers", r.Header))
log.WithFields(log.Fields{
"endpoint": s.PresignedUrl,
"headers": r.Header,
}).Debug("uploading backup to remote S3 endpoint")
return http.DefaultClient.Do(r)
}