MCPcopy
hub / github.com/uber-go/zap / AddSync

Function AddSync

zapcore/write_syncer.go:40–47  ·  view source on GitHub ↗

AddSync converts an io.Writer to a WriteSyncer. It attempts to be intelligent: if the concrete type of the io.Writer implements WriteSyncer, we'll use the existing Sync method. If it doesn't, we'll add a no-op Sync.

(w io.Writer)

Source from the content-addressed store, hash-verified

38// intelligent: if the concrete type of the io.Writer implements WriteSyncer,
39// we'll use the existing Sync method. If it doesn't, we'll add a no-op Sync.
40func AddSync(w io.Writer) WriteSyncer {
41 switch w := w.(type) {
42 case WriteSyncer:
43 return w
44 default:
45 return writerWrapper{w}
46 }
47}
48
49type lockedWriteSyncer struct {
50 sync.Mutex

Callers 15

TestIncreaseLevelFunction · 0.92
TestLoggerWriteFailureFunction · 0.92
NewNopFunction · 0.92
TestRegisterSinkFunction · 0.92
TestRegisterSinkErrorsFunction · 0.92
TestOpenNoPathsFunction · 0.92
withLoggerFunction · 0.92
CombineWriteSyncersFunction · 0.92
TestSlogtestFunction · 0.92

Calls

no outgoing calls

Tested by 15

TestIncreaseLevelFunction · 0.74
TestLoggerWriteFailureFunction · 0.74
TestRegisterSinkFunction · 0.74
TestRegisterSinkErrorsFunction · 0.74
TestOpenNoPathsFunction · 0.74
withLoggerFunction · 0.74
TestSlogtestFunction · 0.74