mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
24 lines
454 B
Go
24 lines
454 B
Go
package util
|
|
|
|
import (
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func LogErr(err error, msgAndArgs ...interface{}) bool {
|
|
if err == nil {
|
|
return false
|
|
}
|
|
|
|
if len(msgAndArgs) == 0 {
|
|
log.WithError(err).Error(err.Error())
|
|
} else if len(msgAndArgs) == 1 {
|
|
msg := msgAndArgs[0].(string)
|
|
log.WithError(err).Error(msg)
|
|
} else if len(msgAndArgs) > 1 {
|
|
msg := msgAndArgs[0].(string)
|
|
log.WithError(err).Errorf(msg, msgAndArgs[1:]...)
|
|
}
|
|
|
|
return true
|
|
}
|