-
Notifications
You must be signed in to change notification settings - Fork 1
/
stream_nil.go
38 lines (31 loc) · 924 Bytes
/
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
package logger
// NilStream is the Stream that writes nowhere
type NilStream struct {
}
// SetFilterLevel sets the filter level of all streams
func (stream *NilStream) SetFilterLevel(level Level) Streamer {
return stream
}
// Write writes the given Record
// implements logger.Stream
func (stream *NilStream) Write(record Record) error {
// This stream does not write anything...
return nil
}
// ShouldWrite tells if the given level should be written to this stream
// implements logger.Stream
func (stream *NilStream) ShouldWrite(level Level) bool {
return false
}
// Flush flushes the stream (makes sure records are actually written)
// implements logger.Stream
func (stream *NilStream) Flush() {
}
// Close closes the stream
func (stream *NilStream) Close() {
}
// String gets a string version
// implements the fmt.Stringer interface
func (stream NilStream) String() string {
return "Stream to nil"
}