refactor: replace logger usage with common.Log for consistent logging

This commit is contained in:
krau
2025-03-21 21:07:53 +08:00
parent 65fee89e14
commit ed0837a89b
27 changed files with 152 additions and 158 deletions
+2 -2
View File
@@ -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 {
+4 -4
View File
@@ -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
}()