(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestConfigWithMissingAttributes(t *testing.T) { |
| 111 | tests := []struct { |
| 112 | desc string |
| 113 | cfg Config |
| 114 | expectErr string |
| 115 | }{ |
| 116 | { |
| 117 | desc: "missing level", |
| 118 | cfg: Config{ |
| 119 | Encoding: "json", |
| 120 | }, |
| 121 | expectErr: "missing Level", |
| 122 | }, |
| 123 | { |
| 124 | desc: "missing encoder time in encoder config", |
| 125 | cfg: Config{ |
| 126 | Level: NewAtomicLevelAt(zapcore.InfoLevel), |
| 127 | Encoding: "json", |
| 128 | EncoderConfig: zapcore.EncoderConfig{ |
| 129 | MessageKey: "msg", |
| 130 | TimeKey: "ts", |
| 131 | }, |
| 132 | }, |
| 133 | expectErr: "missing EncodeTime in EncoderConfig", |
| 134 | }, |
| 135 | } |
| 136 | |
| 137 | for _, tt := range tests { |
| 138 | t.Run(tt.desc, func(t *testing.T) { |
| 139 | cfg := tt.cfg |
| 140 | _, err := cfg.Build() |
| 141 | assert.EqualError(t, err, tt.expectErr) |
| 142 | }) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | func makeSamplerCountingHook() (h func(zapcore.Entry, zapcore.SamplingDecision), |
| 147 | dropped, sampled *atomic.Int64, |
nothing calls this directly
no test coverage detected