build: update logging statements to make json log work - fixes #6038

This changes log statements from log to fs package, which is required for --use-json-log
to properly make log output in JSON format. The recently added custom linting rule,
handled by ruleguard via gocritic via golangci-lint, warns about these and suggests
the alternative. Fixing was therefore basically running "golangci-lint run --fix",
although some manual fixup of mainly imports are necessary following that.
This commit is contained in:
albertony
2024-09-06 17:04:18 +01:00
committed by Nick Craig-Wood
parent 88b0757288
commit bcdfad3c83
64 changed files with 333 additions and 357 deletions
+3 -3
View File
@@ -4,10 +4,10 @@ package pool
import (
"fmt"
"log"
"sync"
"time"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/lib/mmap"
)
@@ -161,7 +161,7 @@ func (bp *Pool) Get() []byte {
bp.alloced++
break
}
log.Printf("Failed to get memory for buffer, waiting for %v: %v", waitTime, err)
fs.Logf(nil, "Failed to get memory for buffer, waiting for %v: %v", waitTime, err)
bp.mu.Unlock()
time.Sleep(waitTime)
bp.mu.Lock()
@@ -178,7 +178,7 @@ func (bp *Pool) Get() []byte {
func (bp *Pool) freeBuffer(mem []byte) {
err := bp.free(mem)
if err != nil {
log.Printf("Failed to free memory: %v", err)
fs.Logf(nil, "Failed to free memory: %v", err)
}
bp.alloced--
}