-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance when disabled #1
Comments
import { LogClass as LogClassOriginal, IClassLoggerConfig } from 'class-logger'
export const LogClass = (config: IClassLoggerConfig) => {
if (process.env.NODE_ENV === 'production') { // It can be any condition you want
return () => undefined // return an empty decorator placeholder
}
return LogClassOriginal(config)
}
@LogClass()
class Test {} This would prevent your class being wrapped with a Proxy, therefore no performance impact at all. |
It would be great if the above info was part of README.md |
This looks awesome! If I wanted this in place for development and test, turned off in production, and only flipped on and off via config, what's the impact to performance in production (while disabled)?
So, say the stuff is all there, it's just off, is there a performance hit? Is every method checking the config and choosing not to log at runtime, or is the injection just not performed in the first place? Or...?
Thanks!
The text was updated successfully, but these errors were encountered: