From 6e2d9e943d950fdd45e83e356d02eeac578189c8 Mon Sep 17 00:00:00 2001 From: Mephisto <1443735959@qq.com> Date: Sun, 24 Mar 2024 15:22:43 +0800 Subject: [PATCH] finish event push to nsq --- util/event-action.go | 4 ++-- util/logger.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/util/event-action.go b/util/event-action.go index 636a0f0..e4d6638 100644 --- a/util/event-action.go +++ b/util/event-action.go @@ -193,9 +193,9 @@ func (eh *eventActionHandler) Handle() model.EventLog { } else { eventLog = eh.createEventLog(createEventLogArgs{}) } - logger := Logger + logger := getLogger() if producer := GetNSQProducer(); producer != nil { - logger.Hooks.Add(&NSQHookForError{ + logger.Hooks.Add(&NSQHookForEvent{ Producer: producer, }) } diff --git a/util/logger.go b/util/logger.go index cfb93bd..71796fd 100644 --- a/util/logger.go +++ b/util/logger.go @@ -32,9 +32,9 @@ func (hook *NSQHookForError) Fire(entry *logrus.Entry) error { return hook.Producer.Publish("log_topic", byte) } -// Levels 返回日志级别,这里只返回 ErrorLevel +// Levels 返回日志级别,这里返回 ErrorLevel,FatalLevel,PanicLevel func (hook *NSQHookForError) Levels() []logrus.Level { - levels := [1]logrus.Level{logrus.ErrorLevel} + levels := [3]logrus.Level{logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel} return levels[:] }