func (hook *SyslogHookNoFrozen) Fire(entry *log.Entry) error { select { case hook.logCh <- entry: default: skippedNew := atomic.AddUint64(&hook.skipped, uint64(1)) log.WithoutHooks().Errorf("syslog entry %v skipped (total %d)", entry, skippedNew) } return nil }
func (hook *SyslogHookNoFrozen) serve() { for { select { case entry := <-hook.logCh: err := hook.syslogHook.Fire(entry) if err != nil { log.WithoutHooks().Errorf("syslog error: %v", err) } case <-hook.exitCh: return } } }