Wrap internal logs with compile-time vscroll_enableLogging guard
#64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change introduces a compile-time
vscroll_enableLoggingflag to guard internal logging calls.Previously, all logger calls (e.g.,
this.logger.log(...)) were evaluated at runtime, even if the logs were not needed in production. Some of these logs use lazy evaluation via closures, but the overhead of logging logic and potential string construction still existed.By wrapping logger calls in
if (vscroll_enableLogging)checks, bundlers like esbuild or Webpack can remove them entirely from production builds using dead code elimination. This reduces the bundle size and runtime cost for consumers who do not rely on internal logs.Consumers can set the flag at build time using:
This change does not affect behavior in development builds where logging is still useful.