@@ -18,7 +18,7 @@ You can check the original license at:
1818package cron
1919
2020import (
21- "io/ioutil "
21+ "io"
2222 "log"
2323 "os"
2424 "strings"
@@ -29,48 +29,48 @@ import (
2929var DefaultLogger Logger = PrintfLogger (log .New (os .Stdout , "cron: " , log .LstdFlags ))
3030
3131// DiscardLogger can be used by callers to discard all log messages.
32- var DiscardLogger Logger = PrintfLogger (log .New (ioutil .Discard , "" , 0 ))
32+ var DiscardLogger Logger = PrintfLogger (log .New (io .Discard , "" , 0 ))
3333
3434// Logger is the interface used in this package for logging, so that any backend
3535// can be plugged in. It is a subset of the github.com/go-logr/logr interface.
3636type Logger interface {
3737 // Info logs routine messages about cron's operation.
38- Info (msg string , keysAndValues ... interface {} )
38+ Info (msg string , keysAndValues ... any )
3939 // Error logs an error condition.
40- Error (err error , msg string , keysAndValues ... interface {} )
40+ Error (err error , msg string , keysAndValues ... any )
4141}
4242
4343// PrintfLogger wraps a Printf-based logger (such as the standard library "log")
4444// into an implementation of the Logger interface which logs errors only.
45- func PrintfLogger (l interface { Printf (string , ... interface {} ) }) Logger {
45+ func PrintfLogger (l interface { Printf (string , ... any ) }) Logger {
4646 return printfLogger {l , false }
4747}
4848
4949// VerbosePrintfLogger wraps a Printf-based logger (such as the standard library
5050// "log") into an implementation of the Logger interface which logs everything.
51- func VerbosePrintfLogger (l interface { Printf (string , ... interface {} ) }) Logger {
51+ func VerbosePrintfLogger (l interface { Printf (string , ... any ) }) Logger {
5252 return printfLogger {l , true }
5353}
5454
5555type printfLogger struct {
56- logger interface { Printf (string , ... interface {} ) }
56+ logger interface { Printf (string , ... any ) }
5757 logInfo bool
5858}
5959
60- func (pl printfLogger ) Info (msg string , keysAndValues ... interface {} ) {
60+ func (pl printfLogger ) Info (msg string , keysAndValues ... any ) {
6161 if pl .logInfo {
6262 keysAndValues = formatTimes (keysAndValues )
6363 pl .logger .Printf (
6464 formatString (len (keysAndValues )),
65- append ([]interface {} {msg }, keysAndValues ... )... )
65+ append ([]any {msg }, keysAndValues ... )... )
6666 }
6767}
6868
69- func (pl printfLogger ) Error (err error , msg string , keysAndValues ... interface {} ) {
69+ func (pl printfLogger ) Error (err error , msg string , keysAndValues ... any ) {
7070 keysAndValues = formatTimes (keysAndValues )
7171 pl .logger .Printf (
7272 formatString (len (keysAndValues )+ 2 ),
73- append ([]interface {} {msg , "error" , err }, keysAndValues ... )... )
73+ append ([]any {msg , "error" , err }, keysAndValues ... )... )
7474}
7575
7676// formatString returns a logfmt-like format string for the number of
@@ -91,8 +91,8 @@ func formatString(numKeysAndValues int) string {
9191}
9292
9393// formatTimes formats any time.Time values as RFC3339.
94- func formatTimes (keysAndValues []interface {} ) []interface {} {
95- var formattedArgs []interface {}
94+ func formatTimes (keysAndValues []any ) []any {
95+ var formattedArgs []any
9696 for _ , arg := range keysAndValues {
9797 if t , ok := arg .(time.Time ); ok {
9898 arg = t .Format (time .RFC3339 )
0 commit comments