Add AddHook method for logger

This commit is contained in:
Aditya Mukerjee 2017-08-04 11:24:22 -04:00
parent 181d419aa9
commit 3d1341ce2c
1 changed files with 6 additions and 0 deletions

View File

@ -315,3 +315,9 @@ func (logger *Logger) level() Level {
func (logger *Logger) SetLevel(level Level) {
atomic.StoreUint32((*uint32)(&logger.Level), uint32(level))
}
func (logger *Logger) AddHook(hook Hook) {
logger.mu.Lock()
defer logger.mu.Unlock()
logger.Hooks.Add(hook)
}