web/webtest: make Logger configurable
continuous-integration/drone the build failed Details

This commit is contained in:
genofire 2021-09-29 14:33:35 +02:00
parent 694ca30e0d
commit 980510a995
1 changed files with 9 additions and 1 deletions

View File

@ -29,6 +29,14 @@ type Option struct {
DBReRun bool DBReRun bool
DBSetup func(db *database.Database) DBSetup func(db *database.Database)
Mailer bool Mailer bool
Logger *zap.Logger
}
func (option Option) log() *zap.Logger {
if option.Logger != nil {
return option.Logger
}
return zap.L()
} }
// TestServer - to run it without listen an server // TestServer - to run it without listen an server
@ -64,7 +72,7 @@ func NewWithDBSetup(modules web.ModuleRegisterFunc, dbCall func(db *database.Dat
// New allows to configure WebService for testing // New allows to configure WebService for testing
func (option Option) New() (*TestServer, error) { func (option Option) New() (*TestServer, error) {
log := zap.L() log := option.log()
ws := &web.Service{} ws := &web.Service{}
ws.SetLog(log) ws.SetLog(log)