github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/logger/config.go (about) 1 package logger 2 3 type Config struct { 4 JSON bool `yaml:"json"` 5 Level string `yaml:"level"` 6 // true to enable log sampling, where the same log message and level will be throttled. 7 // we have two layers of sampling 8 // 1. global sampling - within a second, it will log the first SampleInitial, then every SampleInterval messages. 9 // 2. per participant/track sampling - to be used with Logger.WithItemSampler(). This would be used to throttle 10 // the logs for a particular participant/track. 11 Sample bool `yaml:"sample,omitempty"` 12 13 // global sampling per server 14 // when sampling, the first N logs will be logged 15 SampleInitial int `yaml:"sample_initial,omitempty"` 16 // when sampling, every Mth log will be logged 17 SampleInterval int `yaml:"sample_interval,omitempty"` 18 19 // participant/track level sampling 20 ItemSampleSeconds int `yaml:"item_sample_seconds,omitempty"` 21 ItemSampleInitial int `yaml:"item_sample_initial,omitempty"` 22 ItemSampleInterval int `yaml:"item_sample_interval,omitempty"` 23 }