simplify code of event.msg() (#165)

This commit is contained in:
Zhang Sen 2019-07-19 19:35:57 +08:00 committed by Olivier Poitrey
parent 42d101e9f7
commit a7f9fc2a17
1 changed files with 2 additions and 7 deletions

View File

@ -127,13 +127,8 @@ func (e *Event) Msgf(format string, v ...interface{}) {
}
func (e *Event) msg(msg string) {
if len(e.ch) > 0 {
e.ch[0].Run(e, e.level, msg)
if len(e.ch) > 1 {
for _, hook := range e.ch[1:] {
hook.Run(e, e.level, msg)
}
}
for _, hook := range e.ch {
hook.Run(e, e.level, msg)
}
if msg != "" {
e.buf = enc.AppendString(enc.AppendKey(e.buf, MessageFieldName), msg)