Skip to content

Commit aa2ee45

Browse files
committed
chore: docs
1 parent 1746261 commit aa2ee45

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

packages/logger/src/Logger.ts

+22-8
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,19 @@ class Logger extends Utility implements LoggerInterface {
215215
*/
216216
#buffer?: CircularMap<string>;
217217

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+
*/
219225
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+
*/
220231
refreshedTimes: 0,
221232
};
222233

@@ -569,13 +580,6 @@ class Logger extends Utility implements LoggerInterface {
569580
}
570581
}
571582

572-
#shouldEnableDebugSampling() {
573-
return (
574-
this.#debugLogSampling.sampleRateValue &&
575-
randomInt(0, 100) / 100 <= this.#debugLogSampling.sampleRateValue
576-
);
577-
}
578-
579583
/**
580584
* Remove temporary attributes based on provided keys to all log items generated by this Logger instance.
581585
*
@@ -915,6 +919,16 @@ class Logger extends Utility implements LoggerInterface {
915919
}
916920
}
917921

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+
918932
/**
919933
* Check if a given key is reserved and warn the user if it is.
920934
*

0 commit comments

Comments
 (0)