1
0
mirror of https://github.com/rclone/rclone.git synced 2025-11-29 05:47:23 +02:00

serve s3: fix log output to remove the EXTRA messages

As shown in

81e56a30c8/log.go (L74)

it seems like the wanted behaviour for merging arguments is the one of PrintLn,
which is "put a space between each arg"
This commit is contained in:
iTrooz
2025-10-06 16:17:21 +02:00
committed by GitHub
parent 2bc155a96a
commit f574e3395c

View File

@@ -2,6 +2,7 @@ package s3
import ( import (
"fmt" "fmt"
"strings"
"github.com/rclone/gofakes3" "github.com/rclone/gofakes3"
"github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs"
@@ -12,25 +13,23 @@ type logger struct{}
// print log message // print log message
func (l logger) Print(level gofakes3.LogLevel, v ...any) { func (l logger) Print(level gofakes3.LogLevel, v ...any) {
var s string var b strings.Builder
if len(v) == 0 { for i := range v {
s = "" if i > 0 {
} else { fmt.Fprintf(&b, " ")
var ok bool
s, ok = v[0].(string)
if !ok {
s = fmt.Sprint(v[0])
} }
v = v[1:] fmt.Fprint(&b, v[i])
} }
s := b.String()
switch level { switch level {
default: default:
fallthrough fallthrough
case gofakes3.LogErr: case gofakes3.LogErr:
fs.Errorf("serve s3", s, v...) fs.Errorf("serve s3", s)
case gofakes3.LogWarn: case gofakes3.LogWarn:
fs.Infof("serve s3", s, v...) fs.Infof("serve s3", s)
case gofakes3.LogInfo: case gofakes3.LogInfo:
fs.Debugf("serve s3", s, v...) fs.Debugf("serve s3", s)
} }
} }