1
0
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:
Gerasimos (Makis) Maropoulos
2020-07-20 05:44:12 +03:00
parent 302597faac
commit beb67dc495
3 changed files with 53 additions and 0 deletions

View File

@@ -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
}