File tree 1 file changed +22
-8
lines changed
1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -215,8 +215,19 @@ class Logger extends Utility implements LoggerInterface {
215
215
*/
216
216
#buffer?: CircularMap < string > ;
217
217
218
- #debugLogSampling = {
218
+ /**
219
+ * The debug sampling rate configuration.
220
+ */
221
+ readonly #debugLogSampling = {
222
+ /**
223
+ * The sampling rate value used to determine if the log level should be set to DEBUG.
224
+ */
219
225
sampleRateValue : 0 ,
226
+ /**
227
+ * The number of times the debug sampling rate has been refreshed.
228
+ *
229
+ * We use this to determine if we should refresh it again.
230
+ */
220
231
refreshedTimes : 0 ,
221
232
} ;
222
233
@@ -569,13 +580,6 @@ class Logger extends Utility implements LoggerInterface {
569
580
}
570
581
}
571
582
572
- #shouldEnableDebugSampling( ) {
573
- return (
574
- this . #debugLogSampling. sampleRateValue &&
575
- randomInt ( 0 , 100 ) / 100 <= this . #debugLogSampling. sampleRateValue
576
- ) ;
577
- }
578
-
579
583
/**
580
584
* Remove temporary attributes based on provided keys to all log items generated by this Logger instance.
581
585
*
@@ -915,6 +919,16 @@ class Logger extends Utility implements LoggerInterface {
915
919
}
916
920
}
917
921
922
+ /**
923
+ * Make a new debug log sampling decision based on the sample rate value.
924
+ */
925
+ #shouldEnableDebugSampling( ) {
926
+ return (
927
+ this . #debugLogSampling. sampleRateValue &&
928
+ randomInt ( 0 , 100 ) / 100 <= this . #debugLogSampling. sampleRateValue
929
+ ) ;
930
+ }
931
+
918
932
/**
919
933
* Check if a given key is reserved and warn the user if it is.
920
934
*
You can’t perform that action at this time.
0 commit comments