v0.0.193
This commit is contained in:
@@ -6,12 +6,12 @@ import (
|
||||
)
|
||||
|
||||
type ErrorPackageConfig struct {
|
||||
ZeroLogErrTraces bool // autom print zerolog logs on .Build() (for SevErr and SevFatal)
|
||||
ZeroLogAllTraces bool // autom print zerolog logs on .Build() (for all Severities)
|
||||
RecursiveErrors bool // errors contains their Origin-Error
|
||||
ExtendedGinOutput bool // Log extended data (trace, meta, ...) to gin in err.Output()
|
||||
ExtendGinOutput func(json map[string]any) // (Optionally) extend the gin output with more fields
|
||||
ExtendGinDataOutput func(json map[string]any) // (Optionally) extend the gin `__data` output with more fields
|
||||
ZeroLogErrTraces bool // autom print zerolog logs on .Build() (for SevErr and SevFatal)
|
||||
ZeroLogAllTraces bool // autom print zerolog logs on .Build() (for all Severities)
|
||||
RecursiveErrors bool // errors contains their Origin-Error
|
||||
ExtendedGinOutput bool // Log extended data (trace, meta, ...) to gin in err.Output()
|
||||
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
|
||||
}
|
||||
|
||||
type ErrorPackageConfigInit struct {
|
||||
@@ -19,8 +19,8 @@ type ErrorPackageConfigInit struct {
|
||||
ZeroLogAllTraces bool
|
||||
RecursiveErrors bool
|
||||
ExtendedGinOutput bool
|
||||
ExtendGinOutput *func(json map[string]any)
|
||||
ExtendGinDataOutput *func(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
|
||||
@@ -30,8 +30,8 @@ var pkgconfig = ErrorPackageConfig{
|
||||
ZeroLogAllTraces: false,
|
||||
RecursiveErrors: true,
|
||||
ExtendedGinOutput: false,
|
||||
ExtendGinOutput: func(json map[string]any) {},
|
||||
ExtendGinDataOutput: func(json map[string]any) {},
|
||||
ExtendGinOutput: func(err *ExErr, json map[string]any) {},
|
||||
ExtendGinDataOutput: func(err *ExErr, depth int, json map[string]any) {},
|
||||
}
|
||||
|
||||
// Init initializes the exerr packages
|
||||
@@ -47,8 +47,8 @@ func Init(cfg ErrorPackageConfigInit) {
|
||||
ZeroLogAllTraces: cfg.ZeroLogAllTraces,
|
||||
RecursiveErrors: cfg.RecursiveErrors,
|
||||
ExtendedGinOutput: cfg.ExtendedGinOutput,
|
||||
ExtendGinOutput: langext.Coalesce(cfg.ExtendGinOutput, func(json map[string]any) {}),
|
||||
ExtendGinDataOutput: langext.Coalesce(cfg.ExtendGinDataOutput, func(json map[string]any) {}),
|
||||
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) {}),
|
||||
}
|
||||
|
||||
initialized = true
|
||||
|
Reference in New Issue
Block a user