2022-09-21 17:09:50 +02:00
|
|
|
package s3
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2024-04-13 18:50:11 +02:00
|
|
|
"github.com/rclone/gofakes3"
|
2022-09-21 17:09:50 +02:00
|
|
|
"github.com/rclone/rclone/fs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// logger output formatted message
|
|
|
|
type logger struct{}
|
|
|
|
|
|
|
|
// print log message
|
|
|
|
func (l logger) Print(level gofakes3.LogLevel, v ...interface{}) {
|
2024-08-14 19:19:36 +02:00
|
|
|
var s string
|
|
|
|
if len(v) == 0 {
|
|
|
|
s = ""
|
|
|
|
} else {
|
|
|
|
var ok bool
|
|
|
|
s, ok = v[0].(string)
|
|
|
|
if !ok {
|
|
|
|
s = fmt.Sprint(v[0])
|
|
|
|
}
|
|
|
|
v = v[1:]
|
|
|
|
}
|
2022-09-21 17:09:50 +02:00
|
|
|
switch level {
|
2023-09-12 12:50:13 +02:00
|
|
|
default:
|
|
|
|
fallthrough
|
2022-09-21 17:09:50 +02:00
|
|
|
case gofakes3.LogErr:
|
2024-08-14 19:19:36 +02:00
|
|
|
fs.Errorf("serve s3", s, v...)
|
2022-09-21 17:09:50 +02:00
|
|
|
case gofakes3.LogWarn:
|
2024-08-14 19:19:36 +02:00
|
|
|
fs.Infof("serve s3", s, v...)
|
2022-09-21 17:09:50 +02:00
|
|
|
case gofakes3.LogInfo:
|
2024-08-14 19:19:36 +02:00
|
|
|
fs.Debugf("serve s3", s, v...)
|
2022-09-21 17:09:50 +02:00
|
|
|
}
|
|
|
|
}
|