Skip to content

Commit 273e114

Browse files
committed
log: fix typos in comments (ethereum#21118)
1 parent c95cd72 commit 273e114

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

log/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ This will output a log line that includes the path context that is attached to t
6565
6666
Handlers
6767
68-
The Handler interface defines where log lines are printed to and how they are formated. Handler is a
68+
The Handler interface defines where log lines are printed to and how they are formatted. Handler is a
6969
single interface that is inspired by net/http's handler interface:
7070
7171
type Handler interface {

log/format.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func PrintOrigins(print bool) {
4141
var locationEnabled uint32
4242

4343
// locationLength is the maxmimum path length encountered, which all logs are
44-
// padded to to aid in alignment.
44+
// padded to aid in alignment.
4545
var locationLength uint32
4646

4747
// fieldPadding is a global map with maximum field value lengths seen until now
@@ -78,7 +78,7 @@ type TerminalStringer interface {
7878
// a terminal with color-coded level output and terser human friendly timestamp.
7979
// This format should only be used for interactive programs or while developing.
8080
//
81-
// [TIME] [LEVEL] MESAGE key=value key=value ...
81+
// [TIME] [LEVEL] MESSAGE key=value key=value ...
8282
//
8383
// Example:
8484
//

log/handler.go

+18-22
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func formatCall(format string, c stack.Call) string {
117117
}
118118

119119
// CallerStackHandler returns a Handler that adds a stack trace to the context
120-
// with key "stack". The stack trace is formated as a space separated list of
120+
// with key "stack". The stack trace is formatted as a space separated list of
121121
// call sites inside matching []'s. The most recent call site is listed first.
122122
// Each call site is formatted according to format. See the documentation of
123123
// package github.com/go-stack/stack for the list of supported formats.
@@ -135,15 +135,14 @@ func CallerStackHandler(format string, h Handler) Handler {
135135
// wrapped Handler if the given function evaluates true. For example,
136136
// to only log records where the 'err' key is not nil:
137137
//
138-
// logger.SetHandler(FilterHandler(func(r *Record) bool {
139-
// for i := 0; i < len(r.Ctx); i += 2 {
140-
// if r.Ctx[i] == "err" {
141-
// return r.Ctx[i+1] != nil
142-
// }
143-
// }
144-
// return false
145-
// }, h))
146-
//
138+
// logger.SetHandler(FilterHandler(func(r *Record) bool {
139+
// for i := 0; i < len(r.Ctx); i += 2 {
140+
// if r.Ctx[i] == "err" {
141+
// return r.Ctx[i+1] != nil
142+
// }
143+
// }
144+
// return false
145+
// }, h))
147146
func FilterHandler(fn func(r *Record) bool, h Handler) Handler {
148147
return FuncHandler(func(r *Record) error {
149148
if fn(r) {
@@ -158,8 +157,7 @@ func FilterHandler(fn func(r *Record) bool, h Handler) Handler {
158157
// context matches the value. For example, to only log records
159158
// from your ui package:
160159
//
161-
// log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler)
162-
//
160+
// log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler)
163161
func MatchFilterHandler(key string, value interface{}, h Handler) Handler {
164162
return FilterHandler(func(r *Record) (pass bool) {
165163
switch key {
@@ -185,8 +183,7 @@ func MatchFilterHandler(key string, value interface{}, h Handler) Handler {
185183
// level to the wrapped Handler. For example, to only
186184
// log Error/Crit records:
187185
//
188-
// log.LvlFilterHandler(log.LvlError, log.StdoutHandler)
189-
//
186+
// log.LvlFilterHandler(log.LvlError, log.StdoutHandler)
190187
func LvlFilterHandler(maxLvl Lvl, h Handler) Handler {
191188
return FilterHandler(func(r *Record) (pass bool) {
192189
return r.Lvl <= maxLvl
@@ -198,10 +195,9 @@ func LvlFilterHandler(maxLvl Lvl, h Handler) Handler {
198195
// to different locations. For example, to log to a file and
199196
// standard error:
200197
//
201-
// log.MultiHandler(
202-
// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()),
203-
// log.StderrHandler)
204-
//
198+
// log.MultiHandler(
199+
// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()),
200+
// log.StderrHandler)
205201
func MultiHandler(hs ...Handler) Handler {
206202
return FuncHandler(func(r *Record) error {
207203
for _, h := range hs {
@@ -219,10 +215,10 @@ func MultiHandler(hs ...Handler) Handler {
219215
// to writing to a file if the network fails, and then to
220216
// standard out if the file write fails:
221217
//
222-
// log.FailoverHandler(
223-
// log.Must.NetHandler("tcp", ":9090", log.JsonFormat()),
224-
// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()),
225-
// log.StdoutHandler)
218+
// log.FailoverHandler(
219+
// log.Must.NetHandler("tcp", ":9090", log.JsonFormat()),
220+
// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()),
221+
// log.StdoutHandler)
226222
//
227223
// All writes that do not go to the first handler will add context with keys of
228224
// the form "failover_err_{idx}" which explain the error encountered while

0 commit comments

Comments
 (0)