mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
testing: add a 'Do' helper that accepts http.ResponseWriter and http.Request for integration with the standard net/http/httptest package for easier transition from net/http and other frameworks into Iris
Former-commit-id: 8ec6e3468affc28ce34c9bef6795b444fffa08c5
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/kataras/golog"
|
||||
"github.com/kataras/iris/v12/context"
|
||||
"github.com/kataras/iris/v12/core/netutil"
|
||||
|
||||
@@ -184,6 +185,11 @@ var WithGlobalConfiguration = func(app *Application) {
|
||||
// WithLogLevel sets the `Configuration.LogLevel` field.
|
||||
func WithLogLevel(level string) Configurator {
|
||||
return func(app *Application) {
|
||||
if app.logger == nil {
|
||||
app.logger = golog.Default
|
||||
}
|
||||
app.logger.SetLevel(level) // can be fired through app.Configure.
|
||||
|
||||
app.config.LogLevel = level
|
||||
}
|
||||
}
|
||||
@@ -990,6 +996,11 @@ func WithConfiguration(c Configuration) Configurator {
|
||||
return func(app *Application) {
|
||||
main := app.config
|
||||
|
||||
if main == nil {
|
||||
app.config = &c
|
||||
return
|
||||
}
|
||||
|
||||
if v := c.LogLevel; v != "" {
|
||||
main.LogLevel = v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user