AFAIRE
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scheduler/logger.go

42 lines
1.2 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### scheduler ####### Copyright (c) 2021-2022 losyme ########################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package scheduler
import (
"forge.chapril.org/losyme/zombie"
"github.com/robfig/cron/v3"
)
type Logger interface {
zombie.Logger
Error(msg string, kv ...interface{})
}
type cronLogger struct {
logger Logger
}
func newCronLogger(logger Logger) cron.Logger {
return &cronLogger{logger}
}
func (cl *cronLogger) Info(msg string, kv ...interface{}) {
if cl.logger != nil {
cl.logger.Trace("[scheduler] "+msg, kv...) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
}
}
func (cl *cronLogger) Error(err error, msg string, kv ...interface{}) {
if cl.logger != nil {
nkv := append([]interface{}{nil, err}, kv...)
cl.logger.Error("[scheduler] "+msg, nkv...) //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
}
}
/*
######################################################################################################## @(°_°)@ #######
*/