File tree 3 files changed +13
-11
lines changed
3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ import (
22
22
"io"
23
23
)
24
24
25
- // FmtLogger ...
25
+ // FmtLogger represents a log.Logger that encodes keyvals to a io.Writer in
26
+ // logfmt format.
26
27
type FmtLogger struct {
27
28
output io.Writer
28
29
}
29
30
30
- // NewFmtLogger .. .
31
+ // NewFmtLogger creates a new log.Logger .
31
32
func NewFmtLogger (w io.Writer ) Logger {
32
33
logger := & FmtLogger {
33
34
output : w ,
@@ -36,7 +37,7 @@ func NewFmtLogger(w io.Writer) Logger {
36
37
return logger
37
38
}
38
39
39
- // Log .. .
40
+ // Log encodes encodes keyvals to a io.Writer in logfmt format .
40
41
func (l FmtLogger ) Log (keyvals ... interface {}) error {
41
42
for _ , keyval := range keyvals {
42
43
_ , err := fmt .Fprintf (l .output , "%v " , keyval )
Original file line number Diff line number Diff line change 17
17
18
18
package log
19
19
20
- // Logger is the fundamental interface for all log operations. Log creates a
21
- // log event from keyvals, a variadic sequence of alternating keys and values.
22
- // Implementations must be safe for concurrent use by multiple goroutines. In
23
- // particular, any implementation of Logger that appends to keyvals or
24
- // modifies or retains any of its elements must make a copy first.
20
+ /*
21
+ Logger is the fundamental interface for all log operations.
22
+
23
+ Log creates a log event from keyvals, a variadic sequence of alternating
24
+ keys and values.
25
+ */
25
26
type Logger interface {
26
27
Log (keyvals ... interface {}) error
27
28
}
Original file line number Diff line number Diff line change 17
17
18
18
package log
19
19
20
- // NopLogger is a log.Logger that does nothing.
20
+ // NopLogger represents a log.Logger that does nothing.
21
21
type NopLogger struct {}
22
22
23
- // NewNopLogger .. .
23
+ // NewNopLogger creates a new log.Logger .
24
24
func NewNopLogger () Logger {
25
25
logger := & NopLogger {}
26
26
27
27
return logger
28
28
}
29
29
30
- // Log .. .
30
+ // Log ignores all keyvals received as arguments and does nothing .
31
31
func (l NopLogger ) Log (keyvals ... interface {}) error {
32
32
// Do nothing.
33
33
You can’t perform that action at this time.
0 commit comments