| 1 | // Package log defines the logger interface used in rsync library. |
| 2 | package log |
| 3 | |
| 4 | import ( |
| 5 | "io" |
| 6 | "log" |
| 7 | ) |
| 8 | |
| 9 | // Logger is an interface that allows specifying your own logger. |
| 10 | // By default, the Go log package is used, which prints to stderr. |
| 11 | type Logger interface { |
| 12 | // Printf logs message to the underlying log output. Arguments are handled in the manner of fmt.Printf. |
| 13 | Printf(msg string, a ...any) |
| 14 | |
| 15 | Output(calldepth int, s string) error |
| 16 | } |
| 17 | |
| 18 | const logFlags = log.LstdFlags | log.Lshortfile |
| 19 | |
| 20 | func New(out io.Writer) Logger { |
| 21 | return log.New(out, "", logFlags) |
| 22 | } |