mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
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:
committed by
Nick Craig-Wood
parent
88b0757288
commit
bcdfad3c83
@@ -7,7 +7,6 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math"
|
||||
"math/rand"
|
||||
"os"
|
||||
@@ -16,6 +15,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/lib/file"
|
||||
"github.com/rclone/rclone/lib/random"
|
||||
)
|
||||
@@ -93,13 +93,13 @@ func (t *Test) randomTest() {
|
||||
// logf logs things - not shown unless -v
|
||||
func (t *Test) logf(format string, a ...interface{}) {
|
||||
if *verbose {
|
||||
log.Printf(t.prefix+format, a...)
|
||||
fs.Logf(nil, t.prefix+format, a)
|
||||
}
|
||||
}
|
||||
|
||||
// errorf logs errors
|
||||
func (t *Test) errorf(format string, a ...interface{}) {
|
||||
log.Printf(t.prefix+"ERROR: "+format, a...)
|
||||
fs.Logf(nil, t.prefix+"ERROR: "+format, a)
|
||||
}
|
||||
|
||||
// list test
|
||||
@@ -286,7 +286,7 @@ func main() {
|
||||
flag.Parse()
|
||||
args := flag.Args()
|
||||
if len(args) != 1 {
|
||||
log.Fatalf("%s: Syntax [opts] <directory>", os.Args[0])
|
||||
fs.Fatalf(nil, "%s: Syntax [opts] <directory>", os.Args[0])
|
||||
}
|
||||
dir := args[0]
|
||||
_ = file.MkdirAll(dir, 0777)
|
||||
|
||||
Reference in New Issue
Block a user