We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13f2b53 commit c2335a8Copy full SHA for c2335a8
emf/logger_test.go
@@ -195,6 +195,25 @@ func TestEmf(t *testing.T) {
195
}
196
197
198
+func TestLogger_LogSampled(t *testing.T) {
199
+
200
+ t.Run("never", func(t *testing.T) {
201
+ var buf bytes.Buffer
202
+ emf.NewFor(&buf).Metric("foo", 1).LogSampled(0)
203
+ if buf.Len() > 0 {
204
+ t.Fatal("should be empty")
205
+ }
206
+ })
207
208
+ t.Run("always", func(t *testing.T) {
209
210
+ emf.NewFor(&buf).Metric("foo", 1).LogSampled(100)
211
+ if buf.Len() == 0 {
212
+ t.Fatal("should not be empty")
213
214
215
+}
216
+≠
217
func setenv(t *testing.T, env map[string]string) {
218
for k, v := range env {
219
err := os.Setenv(k, v)
0 commit comments