package bopx import ( "context" "github.com/yuninks/loggerx" ) type Options struct { logger loggerx.LoggerInterface // 日志接口 ignoreKeys []string // 忽略签名的key } type Option func(*Options) func newOptions(opts ...Option) *Options { options := defaultOptions() for _, opt := range opts { opt(options) } return options } func defaultOptions() *Options { return &Options{ logger: loggerx.NewLogger( context.Background(), loggerx.SetEscapeHTML(false), ), ignoreKeys: []string{ "sign", }, } } func WithLogger(logger loggerx.LoggerInterface) Option { return func(o *Options) { o.logger = logger } } func WithIgnoreKeys(keys ...string) Option { return func(o *Options) { o.ignoreKeys = keys } }