Skip to content

Commit 4d42a80

Browse files
committedSep 19, 2018
Add API docs
1 parent 56048d7 commit 4d42a80

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed
 

‎fmt_logger.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ import (
2222
"io"
2323
)
2424

25-
// FmtLogger ...
25+
// FmtLogger represents a log.Logger that encodes keyvals to a io.Writer in
26+
// logfmt format.
2627
type FmtLogger struct {
2728
output io.Writer
2829
}
2930

30-
// NewFmtLogger ...
31+
// NewFmtLogger creates a new log.Logger.
3132
func NewFmtLogger(w io.Writer) Logger {
3233
logger := &FmtLogger{
3334
output: w,
@@ -36,7 +37,7 @@ func NewFmtLogger(w io.Writer) Logger {
3637
return logger
3738
}
3839

39-
// Log ...
40+
// Log encodes encodes keyvals to a io.Writer in logfmt format.
4041
func (l FmtLogger) Log(keyvals ...interface{}) error {
4142
for _, keyval := range keyvals {
4243
_, err := fmt.Fprintf(l.output, "%v ", keyval)

‎log.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717

1818
package log
1919

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+
*/
2526
type Logger interface {
2627
Log(keyvals ...interface{}) error
2728
}

‎nop_logger.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
package log
1919

20-
// NopLogger is a log.Logger that does nothing.
20+
// NopLogger represents a log.Logger that does nothing.
2121
type NopLogger struct{}
2222

23-
// NewNopLogger ...
23+
// NewNopLogger creates a new log.Logger.
2424
func NewNopLogger() Logger {
2525
logger := &NopLogger{}
2626

2727
return logger
2828
}
2929

30-
// Log ...
30+
// Log ignores all keyvals received as arguments and does nothing.
3131
func (l NopLogger) Log(keyvals ...interface{}) error {
3232
// Do nothing.
3333

0 commit comments

Comments
 (0)
Please sign in to comment.