Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
6b4bd5a6f8
|
|||
6df4f5f2a1
|
|||
780905ba35
|
|||
c679797765
|
@@ -38,7 +38,7 @@ var rexIDChecksumConst = rext.W(regexp.MustCompile(`const ChecksumIDGenerator =
|
||||
//go:embed id-generate.template
|
||||
var templateIDGenerateText string
|
||||
|
||||
func GenerateIDSpecs(sourceDir string, destFile string, opt *IDGenOptions) error {
|
||||
func GenerateIDSpecs(sourceDir string, destFile string, opt IDGenOptions) error {
|
||||
|
||||
debugOutput := langext.Coalesce(opt.DebugOutput, false)
|
||||
|
||||
|
@@ -34,10 +34,10 @@ func TestGenerateIDSpecs(t *testing.T) {
|
||||
_, err = cmdext.Runner("tar").Arg("-xvzf").Arg(tmpFile).Arg("-C").Arg(tmpDir).FailOnExitCode().FailOnTimeout().Timeout(time.Minute).Run()
|
||||
tst.AssertNoErr(t, err)
|
||||
|
||||
err = GenerateIDSpecs(tmpDir, tmpDir+"/id_gen.go", &IDGenOptions{DebugOutput: langext.PTrue})
|
||||
err = GenerateIDSpecs(tmpDir, tmpDir+"/id_gen.go", IDGenOptions{DebugOutput: langext.PTrue})
|
||||
tst.AssertNoErr(t, err)
|
||||
|
||||
err = GenerateIDSpecs(tmpDir, tmpDir+"/id_gen.go", &IDGenOptions{DebugOutput: langext.PTrue})
|
||||
err = GenerateIDSpecs(tmpDir, tmpDir+"/id_gen.go", IDGenOptions{DebugOutput: langext.PTrue})
|
||||
tst.AssertNoErr(t, err)
|
||||
|
||||
fmt.Println()
|
||||
|
@@ -39,6 +39,7 @@ type ginRouteSpec struct {
|
||||
type Options struct {
|
||||
AllowCors *bool // Add cors handler to allow all CORS requests on the default http methods
|
||||
GinDebug *bool // Set gin.debug to true (adds more logs)
|
||||
SuppressGinLogs *bool // Suppress our custom gin logs (even if GinDebug == true)
|
||||
BufferBody *bool // Buffers the input body stream, this way the ginext error handler can later include the whole request body
|
||||
Timeout *time.Duration // The default handler timeout
|
||||
ListenerBeforeRequest []func(g *gin.Context) // Register listener that are called before the handler method
|
||||
@@ -51,7 +52,7 @@ func NewEngine(opt Options) *GinWrapper {
|
||||
|
||||
wrapper := &GinWrapper{
|
||||
engine: engine,
|
||||
suppressGinLogs: false,
|
||||
suppressGinLogs: langext.Coalesce(opt.SuppressGinLogs, false),
|
||||
allowCors: langext.Coalesce(opt.AllowCors, false),
|
||||
ginDebug: langext.Coalesce(opt.GinDebug, true),
|
||||
bufferBody: langext.Coalesce(opt.BufferBody, false),
|
||||
@@ -73,12 +74,12 @@ func NewEngine(opt Options) *GinWrapper {
|
||||
if !wrapper.ginDebug {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
|
||||
ginlogger := gin.Logger()
|
||||
engine.Use(func(context *gin.Context) {
|
||||
if !wrapper.suppressGinLogs {
|
||||
if !wrapper.suppressGinLogs {
|
||||
ginlogger := gin.Logger()
|
||||
engine.Use(func(context *gin.Context) {
|
||||
ginlogger(context)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
gin.SetMode(gin.DebugMode)
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.409"
|
||||
const GoextVersion = "0.0.413"
|
||||
|
||||
const GoextVersionTimestamp = "2024-03-11T17:05:10+0100"
|
||||
const GoextVersionTimestamp = "2024-03-11T21:00:30+0100"
|
||||
|
Reference in New Issue
Block a user