logmania/log/hook.go

16 lines
193 B
Go
Raw Normal View History

2017-06-11 03:34:11 +02:00
package log
type Hook func(e *Entry)
var hooks = make([]Hook, 0)
func AddHook(hook Hook) {
hooks = append(hooks, hook)
}
func save(e *Entry) {
for _, hook := range hooks {
hook(e)
}
}