blob: b8765745fd80f6aff826f85618fa010315fb1761 (
plain) (
tree)
|
|
package clog
import (
"fmt"
"os"
)
func log(str string, keyvals []any) {
fmt.Fprint(os.Stderr, str + " ")
for i, j := range keyvals {
if i&1 == 0 {
fmt.Fprintf(os.Stderr, "%v=", j)
} else if i == len(keyvals)-1 {
fmt.Fprintf(os.Stderr, "%#v", j)
} else {
fmt.Fprintf(os.Stderr, "%#v ", j)
}
}
fmt.Fprintln(os.Stderr)
}
func Error(str string, keyvals ...any) {
log("ERROR "+str, keyvals)
}
func Debug(str string, keyvals ...any) {
log("DEBUG "+str, keyvals)
}
func Info(str string, keyvals ...any) {
log("INFO "+str, keyvals)
}
|