-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoplogger.go
58 lines (43 loc) · 1.86 KB
/
noplogger.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
package logger
import "github.com/jcgregorio/slog"
// NopLogger implements slog.Logger and does nothing.
//
type NopLogger struct{}
// NewNopLogger returns an initialized *NopLogger.
func NewNopLogger() *NopLogger {
return &NopLogger{}
}
// Fatal logs a fatal log and then exits the program.
// Arguments are handled in the manner of fmt.Print.
func (n *NopLogger) Fatal(args ...interface{}) {}
// Fatalf logs a fatal log and then exits the program.
// Arguments are handled in the manner of fmt.Printf.
func (*NopLogger) Fatalf(format string, args ...interface{}) {}
// Error logs error logs.
// Arguments are handled in the manner of fmt.Print.
func (*NopLogger) Error(args ...interface{}) {}
// Errorf logs error logs.
// Arguments are handled in the manner of fmt.Printf.
func (*NopLogger) Errorf(format string, args ...interface{}) {}
// Warning logs warning logs.
// Arguments are handled in the manner of fmt.Print.
func (*NopLogger) Warning(args ...interface{}) {}
// Warning logs warning logs.
// Arguments are handled in the manner of fmt.Printf.
func (*NopLogger) Warningf(format string, args ...interface{}) {}
// Info logs informational logs.
// Arguments are handled in the manner of fmt.Print.
func (*NopLogger) Info(args ...interface{}) {}
// Infof logs informational logs.
// Arguments are handled in the manner of fmt.Printf.
func (*NopLogger) Infof(format string, args ...interface{}) {}
// Debug logs debugging logs.
// Arguments are handled in the manner of fmt.Print.
func (*NopLogger) Debug(args ...interface{}) {}
// Debugf logs debugging logs.
// Arguments are handled in the manner of fmt.Printf.
func (*NopLogger) Debugf(format string, args ...interface{}) {}
// Raw sends the string s to the logs without any additional formatting.
func (*NopLogger) Raw(s string) {}
// Assert that we implement the slog.Logger interface:
var _ slog.Logger = (*NopLogger)(nil)