mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-27 17:25:16 +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
|
|
}
|