log_contain.go 1.2 KB
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package option

type LogContainS struct {
	All    StringSlice // grep A | grep B
	Any    StringSlice // grep -E "A|B"
	AllNot StringSlice // grep -v A | grep -v B
	AnyNot StringSlice // grep -v "A" or grep -v "B"
	Err    bool        // error always retain
	Warn   bool        // warn always retain
}

const (
	LogContainName       = "log-contain"
	LogContainNameAll    = LogContainName + "-" + "all"
	LogContainNameAny    = LogContainName + "-" + "any"
	LogContainNameAllNot = LogContainName + "-" + "all-not"
	LogContainNameAnyNot = LogContainName + "-" + "any-not"
	LogContainNameErr    = LogContainName + "-" + "err"
	LogContainNameWarn   = LogContainName + "-" + "warn"
)

const (
	LogContainDescAll    = "log contain all keywords"
	LogContainDescAny    = "log contain one of keywords"
	LogContainDescAnyNot = "log not contain one of keywords"
	LogContainDescAllNot = "log not contain both keywords at the same time"
	LogContainDescErr    = "log always contain error level"
	LogContainDescWarn   = "log always contain warn level"
)

var LogContain = LogContainS{
	All:    StringSlice{},
	Any:    StringSlice{},
	AllNot: StringSlice{},
	AnyNot: StringSlice{},
	Err:    true,
	Warn:   true,
}

func (l LogContainS) Reset() {
}