-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlogger.go
44 lines (34 loc) · 1018 Bytes
/
logger.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
// Copyright (c) 2022, R.I. Pienaar and the Project contributors
//
// SPDX-License-Identifier: Apache-2.0
package asyncjobs
import (
"log"
)
// Logger is a pluggable logger interface
type Logger interface {
Debugf(format string, v ...any)
Infof(format string, v ...any)
Warnf(format string, v ...any)
Errorf(format string, v ...any)
}
// Default console logger
type defaultLogger struct{}
func (l *defaultLogger) Infof(format string, v ...any) {
log.Printf(format, v...)
}
func (l *defaultLogger) Warnf(format string, v ...any) {
log.Printf(format, v...)
}
func (l *defaultLogger) Errorf(format string, v ...any) {
log.Printf(format, v...)
}
func (l *defaultLogger) Debugf(format string, v ...any) {
log.Printf(format, v...)
}
// Logger placeholder
type noopLogger struct{}
func (l *noopLogger) Infof(format string, v ...any) {}
func (l *noopLogger) Warnf(format string, v ...any) {}
func (l *noopLogger) Errorf(format string, v ...any) {}
func (l *noopLogger) Debugf(format string, v ...any) {}