2022-09-21 23:09:50 +08:00
|
|
|
package s3
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2024-04-14 00:50:11 +08:00
|
|
|
"github.com/rclone/gofakes3"
|
2022-09-21 23:09:50 +08: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-15 01:19:36 +08: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 23:09:50 +08:00
|
|
|
switch level {
|
2023-09-12 18:50:13 +08:00
|
|
|
default:
|
|
|
|
fallthrough
|
2022-09-21 23:09:50 +08:00
|
|
|
case gofakes3.LogErr:
|
2024-08-15 01:19:36 +08:00
|
|
|
fs.Errorf("serve s3", s, v...)
|
2022-09-21 23:09:50 +08:00
|
|
|
case gofakes3.LogWarn:
|
2024-08-15 01:19:36 +08:00
|
|
|
fs.Infof("serve s3", s, v...)
|
2022-09-21 23:09:50 +08:00
|
|
|
case gofakes3.LogInfo:
|
2024-08-15 01:19:36 +08:00
|
|
|
fs.Debugf("serve s3", s, v...)
|
2022-09-21 23:09:50 +08:00
|
|
|
}
|
|
|
|
}
|