Skip to content

Commit

Permalink
Add isTracerEnabled to logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nimf committed Feb 9, 2022
1 parent 703971f commit 2334ca9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/grpc-js/src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ export function trace(
tracer: string,
text: string
): void {
if (
!disabledTracers.has(tracer) &&
(allEnabled || enabledTracers.has(tracer))
) {
if (isTracerEnabled(tracer)) {
log(severity, new Date().toISOString() + ' | ' + tracer + ' | ' + text);
}
}

export function isTracerEnabled(tracer: string): boolean {
return !disabledTracers.has(tracer) &&
(allEnabled || enabledTracers.has(tracer));
}

0 comments on commit 2334ca9

Please sign in to comment.