telegramnotifier: show error message in the telegram log

This commit is contained in:
c9s 2022-09-19 14:55:58 +08:00
parent 1c23881da9
commit 7ef008dc4f
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -34,6 +34,12 @@ func (t *LogHook) Fire(e *logrus.Entry) error {
}
var message = fmt.Sprintf("[%s] %s", e.Level.String(), e.Message)
if errData, ok := e.Data[logrus.ErrorKey]; ok {
if err, isErr := errData.(error); isErr {
message += " Error: " + err.Error()
}
}
t.notifier.Notify(message)
return nil
}