-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathlogger.go
36 lines (28 loc) · 840 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
/*
* Copyright (c) 2019 Zenichi Amano
*
* This file is part of go-push-receiver, which is MIT licensed.
* See http://opensource.org/licenses/MIT
*/
package pushreceiver
import "fmt"
// logger is a logger interface compatible with both stdlib and some 3rd party loggers.
type logger interface {
Output(calldepth int, s string) error
}
// ilogger represents the internal logging api we use.
type ilogger interface {
logger
Print(...interface{})
}
// internalLog implements the additional methods used by our internal logging.
type internalLog struct {
logger
}
// Print replicates the behaviour of the standard logger.
func (t internalLog) Print(v ...interface{}) {
t.Output(2, fmt.Sprint(v...))
}
type discard struct{}
func (t discard) Output(int, string) error { return nil }
func (t discard) Print(...interface{}) {}