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