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

Function NewTee

zapcore/tee.go:37–46  ·  view source on GitHub ↗

NewTee creates a Core that duplicates log entries into two or more underlying Cores. Calling it with a single Core returns the input unchanged, and calling it with no input returns a no-op Core.

(cores ...Core)

Source from the content-addressed store, hash-verified

35// Calling it with a single Core returns the input unchanged, and calling
36// it with no input returns a no-op Core.
37func NewTee(cores ...Core) Core {
38 switch len(cores) {
39 case 0:
40 return NewNopCore()
41 case 1:
42 return cores[0]
43 default:
44 return multiCore(cores)
45 }
46}
47
48func (mc multiCore) With(fields []Field) Core {
49 clone := make(multiCore, len(mc))

Callers 9

ExampleWrapCore_wrapFunction · 0.92
TestSlogtestFunction · 0.92
withBenchedTeeFunction · 0.85
withTeeFunction · 0.85
TestTeeUnusualInputFunction · 0.85
TestLevelOfTeeFunction · 0.85
TestTeeEnabledFunction · 0.85
TestTeeSyncFunction · 0.85

Calls 2

NewNopCoreFunction · 0.85
multiCoreTypeAlias · 0.85

Tested by 9

ExampleWrapCore_wrapFunction · 0.74
TestSlogtestFunction · 0.74
withBenchedTeeFunction · 0.68
withTeeFunction · 0.68
TestTeeUnusualInputFunction · 0.68
TestLevelOfTeeFunction · 0.68
TestTeeEnabledFunction · 0.68
TestTeeSyncFunction · 0.68