diff --git a/api/receive/main.go b/api/receive/main.go index c8ec475..ff3e14b 100644 --- a/api/receive/main.go +++ b/api/receive/main.go @@ -10,6 +10,8 @@ import ( "github.com/genofire/logmania/database" "github.com/genofire/logmania/log" "github.com/genofire/logmania/notify" + + logOutput "github.com/genofire/logmania/log/hook/output" ) // http.Handler for init network @@ -79,6 +81,12 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { dbEntry := database.InsertEntry(token, &entry) if dbEntry != nil && h.Notify != nil { h.Notify.Send(dbEntry) + } else { + l := logOutput.NewLogger() + e := log.New() + e.Text = "No notifier found" + e.Level = log.WarnLevel + l.Hook(e) } } } diff --git a/cmd/logmania/selflog.go b/cmd/logmania/selflog.go index 4e576cc..6ca6d9b 100644 --- a/cmd/logmania/selflog.go +++ b/cmd/logmania/selflog.go @@ -3,6 +3,8 @@ package main import ( "github.com/genofire/logmania/database" "github.com/genofire/logmania/log" + + logOutput "github.com/genofire/logmania/log/hook/output" ) type SelfLogger struct { @@ -35,6 +37,12 @@ func (l *SelfLogger) Hook(e *log.Entry) { dbEntry := database.InsertEntry("", e) if dbEntry != nil && notifier != nil { notifier.Send(dbEntry) + } else { + l := logOutput.NewLogger() + e := log.New() + e.Text = "No notifier found" + e.Level = log.WarnLevel + l.Hook(e) } } diff --git a/notify/all/internal.go b/notify/all/internal.go index 8b7c994..d2b2fd9 100644 --- a/notify/all/internal.go +++ b/notify/all/internal.go @@ -28,7 +28,7 @@ func NotifyInit(config *lib.NotifyConfig) notify.Notifier { func (n *Notifier) Send(entry *database.Entry) { for _, item := range n.list { - item.Send(entry) + go item.Send(entry) } }