v0.0.594 Add exerr OutputRaw(http.ResponseWriter) method
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m35s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m35s
This commit is contained in:
@@ -456,10 +456,19 @@ func (b *Builder) Output(ctx context.Context, g *gin.Context) {
|
||||
|
||||
// this is only here to add one level to the trace
|
||||
// so that .Build() and .Output() and .Print() have the same depth and our stack-skip logger can have the same skip-count
|
||||
b.doOutput(ctx, g)
|
||||
b.doGinOutput(ctx, g)
|
||||
}
|
||||
|
||||
func (b *Builder) doOutput(ctx context.Context, g *gin.Context) {
|
||||
// OutputRaw works teh same as Output() - but does not depend on gin and works with a raw http.ResponseWriter
|
||||
func (b *Builder) OutputRaw(w http.ResponseWriter) {
|
||||
warnOnPkgConfigNotInitialized()
|
||||
|
||||
// this is only here to add one level to the trace
|
||||
// so that .Build() and .Output() and .Print() have the same depth and our stack-skip logger can have the same skip-count
|
||||
b.doRawOutput(w)
|
||||
}
|
||||
|
||||
func (b *Builder) doGinOutput(ctx context.Context, g *gin.Context) {
|
||||
b.errorData.Output(g)
|
||||
|
||||
if (b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal) && (pkgconfig.ZeroLogErrGinOutput || pkgconfig.ZeroLogAllGinOutput) {
|
||||
@@ -471,6 +480,18 @@ func (b *Builder) doOutput(ctx context.Context, g *gin.Context) {
|
||||
b.errorData.CallListener(MethodOutput, ListenerOpt{NoLog: b.noLog})
|
||||
}
|
||||
|
||||
func (b *Builder) doRawOutput(w http.ResponseWriter) {
|
||||
b.errorData.OutputRaw(w)
|
||||
|
||||
if (b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal) && (pkgconfig.ZeroLogErrGinOutput || pkgconfig.ZeroLogAllGinOutput) {
|
||||
b.errorData.Log(pkgconfig.ZeroLogger.Error())
|
||||
} else if (b.errorData.Severity == SevWarn) && (pkgconfig.ZeroLogAllGinOutput) {
|
||||
b.errorData.Log(pkgconfig.ZeroLogger.Warn())
|
||||
}
|
||||
|
||||
b.errorData.CallListener(MethodOutput, ListenerOpt{NoLog: b.noLog})
|
||||
}
|
||||
|
||||
// Print prints the error
|
||||
// If the error is SevErr we also send it to the error-service
|
||||
func (b *Builder) Print(ctxs ...context.Context) Proxy {
|
||||
|
Reference in New Issue
Block a user