Remove unused hook field on event
This commit is contained in:
parent
624b3116d8
commit
972f27185c
11
event.go
11
event.go
|
@ -31,7 +31,6 @@ type Event struct {
|
||||||
level Level
|
level Level
|
||||||
done func(msg string)
|
done func(msg string)
|
||||||
ch []Hook // hooks from context
|
ch []Hook // hooks from context
|
||||||
h []Hook
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogObjectMarshaler provides a strongly-typed and encoding-agnostic interface
|
// LogObjectMarshaler provides a strongly-typed and encoding-agnostic interface
|
||||||
|
@ -49,7 +48,7 @@ type LogArrayMarshaler interface {
|
||||||
func newEvent(w LevelWriter, level Level) *Event {
|
func newEvent(w LevelWriter, level Level) *Event {
|
||||||
e := eventPool.Get().(*Event)
|
e := eventPool.Get().(*Event)
|
||||||
e.buf = e.buf[:0]
|
e.buf = e.buf[:0]
|
||||||
e.h = e.h[:0]
|
e.ch = nil
|
||||||
e.buf = enc.AppendBeginMarker(e.buf)
|
e.buf = enc.AppendBeginMarker(e.buf)
|
||||||
e.w = w
|
e.w = w
|
||||||
e.level = level
|
e.level = level
|
||||||
|
@ -114,14 +113,6 @@ func (e *Event) msg(msg string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(e.h) > 0 {
|
|
||||||
e.h[0].Run(e, e.level, msg)
|
|
||||||
if len(e.h) > 1 {
|
|
||||||
for _, hook := range e.h[1:] {
|
|
||||||
hook.Run(e, e.level, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
e.buf = enc.AppendString(enc.AppendKey(e.buf, MessageFieldName), msg)
|
e.buf = enc.AppendString(enc.AppendKey(e.buf, MessageFieldName), msg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue