package modules import ( "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/utils/mapstructure" ) type ( IOptions interface { core.IModuleOptions GetDebug() bool GetLog() log.ILog } Options struct { Debug bool //日志是否开启 Log log.ILog } ) func (this *Options) GetDebug() bool { return this.Debug } func (this *Options) GetLog() log.ILog { return this.Log } func (this *Options) LoadConfig(settings map[string]interface{}) (err error) { if settings != nil { err = mapstructure.Decode(settings, this) } if this.Debug && this.Log == nil { this.Log = log.Clone() if this.Log == nil { err = fmt.Errorf("Log is nil") return } } return }