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-08-18 16:58:35 +02:00
committed by Nick Craig-Wood
parent 88b0757288
commit bcdfad3c83
64 changed files with 333 additions and 357 deletions

View File

@@ -2,8 +2,8 @@ package http
import (
"bytes"
"fmt"
"html/template"
"log"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/flags"
@@ -42,7 +42,7 @@ Use ` + "`--{{ .Prefix }}salt`" + ` to change the password hashing salt from the
`
tmpl, err := template.New("auth help").Parse(help)
if err != nil {
log.Fatal("Fatal error parsing template", err)
fs.Fatal(nil, fmt.Sprint("Fatal error parsing template", err))
}
data := struct {
@@ -53,7 +53,7 @@ Use ` + "`--{{ .Prefix }}salt`" + ` to change the password hashing salt from the
buf := &bytes.Buffer{}
err = tmpl.Execute(buf, data)
if err != nil {
log.Fatal("Fatal error executing template", err)
fs.Fatal(nil, fmt.Sprint("Fatal error executing template", err))
}
return buf.String()
}