v0.0.595 fix zerlog channel for exerr [ZeroLogErrTraces] output and WRN errors
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m33s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m33s
This commit is contained in:
@@ -5,17 +5,18 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/dataext"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/enums"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
//
|
||||
@@ -430,12 +431,22 @@ func (b *Builder) BuildAsExerr(ctxs ...context.Context) *ExErr {
|
||||
return FromError(b.wrappedErr)
|
||||
}
|
||||
|
||||
if pkgconfig.ZeroLogErrTraces && !b.noLog && (b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal) {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Error())
|
||||
} else if pkgconfig.ZeroLogAllTraces && !b.noLog {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Error())
|
||||
}
|
||||
if pkgconfig.ZeroLogErrTraces && !b.noLog {
|
||||
if b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Error())
|
||||
} else if b.errorData.Severity == SevWarn {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Warn())
|
||||
} else if b.errorData.Severity == SevInfo {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Info())
|
||||
} else if b.errorData.Severity == SevDebug {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Debug())
|
||||
} else if b.errorData.Severity == SevTrace {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Trace())
|
||||
} else {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Error()) // ?!? unknown severity
|
||||
}
|
||||
|
||||
}
|
||||
b.errorData.CallListener(MethodBuild, ListenerOpt{NoLog: b.noLog})
|
||||
|
||||
return b.errorData
|
||||
@@ -513,8 +524,12 @@ func (b *Builder) doPrint() Proxy {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Warn())
|
||||
} else if b.errorData.Severity == SevInfo {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Info())
|
||||
} else {
|
||||
} else if b.errorData.Severity == SevDebug {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Debug())
|
||||
} else if b.errorData.Severity == SevTrace {
|
||||
b.errorData.ShortLog(pkgconfig.ZeroLogger.Trace())
|
||||
} else {
|
||||
b.errorData.Log(pkgconfig.ZeroLogger.Error()) // ?!? unknown severity
|
||||
}
|
||||
|
||||
b.errorData.CallListener(MethodPrint, ListenerOpt{NoLog: b.noLog})
|
||||
|
Reference in New Issue
Block a user