added to the logger interface
This commit is contained in:
parent
dc5f8b6e5a
commit
f9a712bc33
@ -2,14 +2,13 @@ package log
|
||||
|
||||
// Logger is a logging interface with only the essentials that a function that needs to log should care about. Compatible with standard Go logger.
|
||||
type Logger interface {
|
||||
Print(v ...interface{})
|
||||
Printf(format string, v ...interface{})
|
||||
Println(v ...interface{})
|
||||
Fatal(v ...any)
|
||||
Fatalf(format string, v ...any)
|
||||
Fatalln(v ...any)
|
||||
Panic(v ...any)
|
||||
Panicf(format string, v ...any)
|
||||
Panicln(v ...any)
|
||||
Print(v ...any)
|
||||
Printf(format string, v ...any)
|
||||
Println(v ...any)
|
||||
}
|
||||
|
||||
// None provides a logger that doesnt log anything
|
||||
type None struct{}
|
||||
|
||||
func (n None) Print(v ...interface{}) {}
|
||||
func (n None) Printf(format string, v ...interface{}) {}
|
||||
func (n None) Println(v ...interface{}) {}
|
||||
|
14
log/none.go
Normal file
14
log/none.go
Normal file
@ -0,0 +1,14 @@
|
||||
package log
|
||||
|
||||
// None provides a logger that doesnt log anything
|
||||
type None struct{}
|
||||
|
||||
func (n None) Fatal(v ...any) {}
|
||||
func (n None) Fatalf(format string, v ...any) {}
|
||||
func (n None) Fatalln(v ...any) {}
|
||||
func (n None) Panic(v ...any) {}
|
||||
func (n None) Panicf(format string, v ...any) {}
|
||||
func (n None) Panicln(v ...any) {}
|
||||
func (n None) Print(v ...any) {}
|
||||
func (n None) Printf(format string, v ...any) {}
|
||||
func (n None) Println(v ...any) {}
|
Loading…
Reference in New Issue
Block a user