代码拉取完成,页面将自动刷新
package logp
// Option configures the logp package behavior.
type Option func(cfg *Config)
// WithLevel specifies the logging level.
func WithLevel(level Level) Option {
return func(cfg *Config) {
cfg.Level = level
}
}
// WithSelectors specifies what debug selectors are enabled. If no selectors are
// specified then they are all enabled.
func WithSelectors(selectors ...string) Option {
return func(cfg *Config) {
cfg.Selectors = append(cfg.Selectors, selectors...)
}
}
// ToObserverOutput specifies that the output should be collected in memory so
// that they can be read by an observer by calling ObserverLogs().
func ToObserverOutput() Option {
return func(cfg *Config) {
cfg.toObserver = true
cfg.ToStderr = false
}
}
// ToDiscardOutput configures the logger to write to io.Discard. This is for
// benchmarking purposes only.
func ToDiscardOutput() Option {
return func(cfg *Config) {
cfg.toIODiscard = true
cfg.ToStderr = false
}
}
// AsJSON specifies to log the output as JSON.
func AsJSON() Option {
return func(cfg *Config) {
cfg.JSON = true
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。