-
Notifications
You must be signed in to change notification settings - Fork 1
/
stream-nil.go
85 lines (74 loc) · 2.05 KB
/
stream-nil.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package logger
// NilStream is the Stream that writes nowhere
type NilStream struct {
}
// GetFilterLevels gets the filter levels
//
// implements logger.Streamer
func (stream *NilStream) GetFilterLevels() LevelSet {
return LevelSet{}
}
// SetFilterLevel sets the filter level
//
// If present, the first parameter is the topic.
//
// If present, the second parameter is the scope.
//
// implements logger.FilterSetter
func (stream *NilStream) SetFilterLevel(level Level, parameters ...string) {
}
// FilterMore tells the stream to filter more
//
// The stream will filter more if it is not already at the highest level.
// Which means less log messages will be written to the stream
//
// Example: if the stream is at DEBUG, it will be filtering at INFO
//
// implements logger.FilterModifier
func (stream *NilStream) FilterMore() {
}
// FilterLess tells the stream to filter less
//
// The stream will filter less if it is not already at the lowest level.
// Which means more log messages will be written to the stream
//
// Example: if the stream is at INFO, it will be filtering at DEBUG
//
// implements logger.FilterModifier
func (stream *NilStream) FilterLess() {
}
// Write writes the given Record
//
// implements logger.Streamer
func (stream *NilStream) Write(record Record) error {
// This stream does not write anything...
return nil
}
// ShouldLogSourceInfo tells if the source info should be logged
//
// implements logger.Streamer
func (stream *NilStream) ShouldLogSourceInfo() bool {
return false
}
// ShouldWrite tells if the given level should be written to this stream
//
// implements logger.Streamer
func (stream *NilStream) ShouldWrite(level Level, topic, scope string) bool {
return false
}
// Flush flushes the stream (makes sure records are actually written)
//
// implements logger.Streamer
func (stream *NilStream) Flush() {
}
// Close closes the stream
//
// implements logger.Streamer
func (stream *NilStream) Close() {
}
// String gets a string version
//
// implements fmt.Stringer
func (stream NilStream) String() string {
return "Stream to nil"
}