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)
| 35 | // Calling it with a single Core returns the input unchanged, and calling |
| 36 | // it with no input returns a no-op Core. |
| 37 | func 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 | |
| 48 | func (mc multiCore) With(fields []Field) Core { |
| 49 | clone := make(multiCore, len(mc)) |