This commit is contained in:
wangchuxiao
2023-03-10 19:53:08 +08:00
parent 7a248377f0
commit fd186e9e82
2 changed files with 48 additions and 61 deletions
+7 -20
View File
@@ -1,23 +1,10 @@
package log
type Config struct {
JSON bool `yaml:"json"`
Level string `yaml:"level"`
// true to enable log sampling, where the same log message and level will be throttled.
// we have two layers of sampling
// 1. global sampling - within a second, it will log the first SampleInitial, then every SampleInterval messages.
// 2. per participant/track sampling - to be used with Logger.WithItemSampler(). This would be used to throttle
// the logs for a particular participant/track.
Sample bool `yaml:"sample,omitempty"`
// global sampling per server
// when sampling, the first N logs will be logged
SampleInitial int `yaml:"sample_initial,omitempty"`
// when sampling, every Mth log will be logged
SampleInterval int `yaml:"sample_interval,omitempty"`
// participant/track level sampling
ItemSampleSeconds int `yaml:"item_sample_seconds,omitempty"`
ItemSampleInitial int `yaml:"item_sample_initial,omitempty"`
ItemSampleInterval int `yaml:"item_sample_interval,omitempty"`
var logMap = map[int]int{
6: -1,
5: 0,
4: 1,
3: 2,
2: 3,
1: 4,
}