1 Star 0 Fork 0

sqos/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
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
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sqos/beats.git
git@gitee.com:sqos/beats.git
sqos
beats
beats
v6.2.0

搜索帮助