(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestStacktraceWithCallerSkip(t *testing.T) { |
| 134 | withLogger(t, func(logger *zap.Logger, out *bytes.Buffer) { |
| 135 | logger = logger.WithOptions(zap.AddCallerSkip(2)) |
| 136 | func() { |
| 137 | logger.Error("test log") |
| 138 | }() |
| 139 | |
| 140 | require.NotContains(t, out.String(), "TestStacktraceWithCallerSkip.", "Should skip as requested by caller skip") |
| 141 | require.Contains(t, out.String(), "TestStacktraceWithCallerSkip", "Should not skip too much") |
| 142 | verifyNoZap(t, out.String()) |
| 143 | }) |
| 144 | } |
| 145 | |
| 146 | // withLogger sets up a logger with a real encoder set up, so that any marshal functions are called. |
| 147 | // The inbuilt observer does not call Marshal for objects/arrays, which we need for some tests. |
nothing calls this directly
no test coverage detected