mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-09-04 23:26:39 +08:00
refactor: replace logger usage with common.Log for consistent logging
This commit is contained in:
@@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"path"
|
||||
|
||||
"github.com/krau/SaveAny-Bot/common"
|
||||
config "github.com/krau/SaveAny-Bot/config/storage"
|
||||
"github.com/krau/SaveAny-Bot/logger"
|
||||
"github.com/krau/SaveAny-Bot/types"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
@@ -60,7 +60,7 @@ func (m *Minio) JoinStoragePath(task types.Task) string {
|
||||
}
|
||||
|
||||
func (m *Minio) Save(ctx context.Context, localFilePath, storagePath string) error {
|
||||
logger.L.Infof("Saving file %s to %s", localFilePath, storagePath)
|
||||
common.Log.Infof("Saving file %s to %s", localFilePath, storagePath)
|
||||
|
||||
_, err := m.client.FPutObject(ctx, m.config.BucketName, storagePath, localFilePath, minio.PutObjectOptions{})
|
||||
if err != nil {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/krau/SaveAny-Bot/logger"
|
||||
"github.com/krau/SaveAny-Bot/common"
|
||||
"github.com/minio/minio-go/v7"
|
||||
)
|
||||
|
||||
@@ -48,7 +48,7 @@ func (w *MinioWriter) Close() error {
|
||||
}
|
||||
|
||||
func (m *Minio) NewUploadStream(ctx context.Context, storagePath string) (io.WriteCloser, error) {
|
||||
logger.L.Infof("Creating upload stream for %s", storagePath)
|
||||
common.Log.Infof("Creating upload stream for %s", storagePath)
|
||||
|
||||
uploadCtx, cancel := context.WithCancel(ctx)
|
||||
pipeReader, pipeWriter := io.Pipe()
|
||||
@@ -73,12 +73,12 @@ func (m *Minio) NewUploadStream(ctx context.Context, storagePath string) (io.Wri
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
logger.L.Errorf("Failed to upload to %s: %v", storagePath, err)
|
||||
common.Log.Errorf("Failed to upload to %s: %v", storagePath, err)
|
||||
done <- err
|
||||
return
|
||||
}
|
||||
|
||||
logger.L.Infof("uploaded %d bytes to %s", info.Size, storagePath)
|
||||
common.Log.Infof("uploaded %d bytes to %s", info.Size, storagePath)
|
||||
done <- nil
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user