From 2d14ce3303e20e4191f9e5060d9f3f7a1a33c617 Mon Sep 17 00:00:00 2001 From: postmannen Date: Mon, 6 Jan 2025 16:28:15 +0100 Subject: [PATCH] added logDebug to errSend method to print all errors also to console --- errorkernel.go | 12 +++++++++++- process.go | 5 ----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/errorkernel.go b/errorkernel.go index 9fbdc6d..51fc435 100644 --- a/errorkernel.go +++ b/errorkernel.go @@ -205,7 +205,6 @@ func (e *errorKernel) start(ringBufferBulkInCh chan<- Message) error { }() default: - // fmt.Printf(" * case default\n") } } } @@ -254,6 +253,17 @@ func (e *errorKernel) errSend(proc process, msg Message, err error, logLevel log } e.errorCh <- ev + + switch logLevel { + case logError: + e.logError(err) + case logInfo: + e.logInfo(err) + case logWarning: + e.logWarn(err) + case logDebug: + e.logDebug(err) + } } // infoSend will just send an info message to the errorCentral. diff --git a/process.go b/process.go index d25bb12..29f4948 100644 --- a/process.go +++ b/process.go @@ -196,7 +196,6 @@ func (p process) startSubscriber() { if err != nil { er := fmt.Errorf("error: spawnWorker: got <-ctx.Done, but unable to unsubscribe natsSubscription failed: %v", err) p.errorKernel.errSend(p, Message{}, er, logError) - p.errorKernel.logDebug(er) } p.processes.active.mu.Lock() @@ -531,7 +530,6 @@ func (p process) callHandler(message Message, thisNode string) { // ACL/Signature checking failed. er := fmt.Errorf("error: subscriberHandler: ACL were verified not-OK, doing nothing") p.errorKernel.errSend(p, message, er, logWarning) - p.errorKernel.logDebug(er) } }() @@ -566,7 +564,6 @@ func executeHandler(p process, message Message, thisNode string) { if err != nil { er := fmt.Errorf("error: subscriberHandler: handler method failed: %v", err) p.errorKernel.errSend(p, message, er, logError) - p.errorKernel.logDebug(er) } }() @@ -583,7 +580,6 @@ func executeHandler(p process, message Message, thisNode string) { if err != nil { er := fmt.Errorf("error: subscriberHandler: handler method failed: %v", err) p.errorKernel.errSend(p, message, er, logError) - p.errorKernel.logDebug(er) } }() @@ -609,7 +605,6 @@ func executeHandler(p process, message Message, thisNode string) { if err != nil { er := fmt.Errorf("error: subscriberHandler: handler method failed: %v", err) p.errorKernel.errSend(p, message, er, logError) - p.errorKernel.logDebug(er) } }() }