File tree Expand file tree Collapse file tree 2 files changed +0
-29
lines changed Expand file tree Collapse file tree 2 files changed +0
-29
lines changed Original file line number Diff line number Diff line change 4
4
"encoding/json"
5
5
"fmt"
6
6
"io"
7
- "math/rand"
8
7
"os"
9
8
"strings"
10
9
"time"
@@ -170,15 +169,6 @@ func (l *Logger) Log() {
170
169
_ , _ = fmt .Fprintln (l .out , string (buf ))
171
170
}
172
171
173
- // LogSampled samples Log calls based on a rate.
174
- // Ex. rate of 0.7 means Log will be called 70% of a time.
175
- func (l * Logger ) LogSampled (rate float64 ) {
176
- rand .Seed (time .Now ().UnixNano ())
177
- if rand .Float64 () < rate {
178
- l .Log ()
179
- }
180
- }
181
-
182
172
// NewContext creates new context for given logger.
183
173
func (l * Logger ) NewContext () * Context {
184
174
c := newContext (l .values )
Original file line number Diff line number Diff line change @@ -195,25 +195,6 @@ func TestEmf(t *testing.T) {
195
195
}
196
196
}
197
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
- var buf bytes.Buffer
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
198
func setenv (t * testing.T , env map [string ]string ) {
218
199
for k , v := range env {
219
200
err := os .Setenv (k , v )
You can’t perform that action at this time.
0 commit comments