This commit is contained in:
Mike Schwörer 2023-07-24 11:42:52 +02:00
parent bbd7a7bc2c
commit a73d7d1654
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 16 additions and 6 deletions

View File

@ -19,8 +19,8 @@ type ErrorPackageConfigInit struct {
ZeroLogAllTraces bool
RecursiveErrors bool
ExtendedGinOutput bool
ExtendGinOutput *func(err *ExErr, json map[string]any)
ExtendGinDataOutput *func(err *ExErr, depth int, json map[string]any)
ExtendGinOutput func(err *ExErr, json map[string]any)
ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any)
}
var initialized = false
@ -42,13 +42,23 @@ func Init(cfg ErrorPackageConfigInit) {
panic("Cannot re-init error package")
}
ego := func(err *ExErr, json map[string]any) {}
egdo := func(err *ExErr, depth int, json map[string]any) {}
if cfg.ExtendGinOutput != nil {
ego = cfg.ExtendGinOutput
}
if cfg.ExtendGinDataOutput != nil {
egdo = cfg.ExtendGinDataOutput
}
pkgconfig = ErrorPackageConfig{
ZeroLogErrTraces: cfg.ZeroLogErrTraces,
ZeroLogAllTraces: cfg.ZeroLogAllTraces,
RecursiveErrors: cfg.RecursiveErrors,
ExtendedGinOutput: cfg.ExtendedGinOutput,
ExtendGinOutput: langext.Coalesce(cfg.ExtendGinOutput, func(err *ExErr, json map[string]any) {}),
ExtendGinDataOutput: langext.Coalesce(cfg.ExtendGinDataOutput, func(err *ExErr, depth int, json map[string]any) {}),
ExtendGinOutput: ego,
ExtendGinDataOutput: egdo,
}
initialized = true

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.194"
const GoextVersion = "0.0.195"
const GoextVersionTimestamp = "2023-07-24T11:40:47+0200"
const GoextVersionTimestamp = "2023-07-24T11:42:52+0200"