MCPcopy Create free account
hub / github.com/google/go-cloud / NewStackdriverLogger

Function NewStackdriverLogger

server/requestlog/stackdriver.go:40–47  ·  view source on GitHub ↗

NewStackdriverLogger returns a new logger that writes to w. A nil onErr is treated the same as func(error) {}.

(w io.Writer, onErr func(error))

Source from the content-addressed store, hash-verified

38// NewStackdriverLogger returns a new logger that writes to w.
39// A nil onErr is treated the same as func(error) {}.
40func NewStackdriverLogger(w io.Writer, onErr func(error)) *StackdriverLogger {
41 l := &StackdriverLogger{
42 w: w,
43 onErr: onErr,
44 }
45 l.enc = json.NewEncoder(&l.buf)
46 return l
47}
48
49// Log writes a record to its writer. Multiple concurrent calls will
50// produce sequential writes to its writer.

Callers 4

NewRequestLoggerFunction · 0.92
TestStackdriverLogFunction · 0.85
BenchmarkStackdriverLogFunction · 0.85
BenchmarkE2EFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestStackdriverLogFunction · 0.68
BenchmarkStackdriverLogFunction · 0.68
BenchmarkE2EFunction · 0.68