v0.0.433 fix exerr missing gindata when using ginext.Error and add config for Output logging to stderr
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m0s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m0s
This commit is contained in:
@@ -14,6 +14,8 @@ type ErrorPackageConfig struct {
|
||||
ExtendGinOutput func(err *ExErr, json map[string]any) // (Optionally) extend the gin output with more fields
|
||||
ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any) // (Optionally) extend the gin `__data` output with more fields
|
||||
DisableErrorWrapping bool // Disables the exerr.Wrap()...Build() function - will always return the original error
|
||||
ZeroLogErrGinOutput bool // autom print zerolog logs on ginext.Error() / .Output(gin) (for SevErr and SevFatal)
|
||||
ZeroLogAllGinOutput bool // autom print zerolog logs on ginext.Error() / .Output(gin) (for all Severities)
|
||||
}
|
||||
|
||||
type ErrorPackageConfigInit struct {
|
||||
@@ -25,6 +27,8 @@ type ErrorPackageConfigInit struct {
|
||||
ExtendGinOutput func(err *ExErr, json map[string]any)
|
||||
ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any)
|
||||
DisableErrorWrapping *bool
|
||||
ZeroLogErrGinOutput *bool
|
||||
ZeroLogAllGinOutput *bool
|
||||
}
|
||||
|
||||
var initialized = false
|
||||
@@ -38,6 +42,8 @@ var pkgconfig = ErrorPackageConfig{
|
||||
ExtendGinOutput: func(err *ExErr, json map[string]any) {},
|
||||
ExtendGinDataOutput: func(err *ExErr, depth int, json map[string]any) {},
|
||||
DisableErrorWrapping: false,
|
||||
ZeroLogErrGinOutput: true,
|
||||
ZeroLogAllGinOutput: false,
|
||||
}
|
||||
|
||||
// Init initializes the exerr packages
|
||||
@@ -67,6 +73,8 @@ func Init(cfg ErrorPackageConfigInit) {
|
||||
ExtendGinOutput: ego,
|
||||
ExtendGinDataOutput: egdo,
|
||||
DisableErrorWrapping: langext.Coalesce(cfg.DisableErrorWrapping, pkgconfig.DisableErrorWrapping),
|
||||
ZeroLogAllGinOutput: langext.Coalesce(cfg.ZeroLogAllGinOutput, pkgconfig.ZeroLogAllGinOutput),
|
||||
ZeroLogErrGinOutput: langext.Coalesce(cfg.ZeroLogErrGinOutput, pkgconfig.ZeroLogErrGinOutput),
|
||||
}
|
||||
|
||||
initialized = true
|
||||
|
Reference in New Issue
Block a user