Wrap internal logs with compile-time `vscroll_enableLogging` guard
This change introduces a compile-time vscroll_enableLogging flag 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:
// esbuild
define: {
vscroll_enableLogging: JSON.stringify(false)
}
// Webpack DefinePlugin
new webpack.DefinePlugin({
vscroll_enableLogging: JSON.stringify(false)
});
This change does not affect behavior in development builds where logging is still useful.