#Impact of Logger
17 messages · Page 1 of 1 (latest)
You might have some startup lag. Depending on how the verbose output is ignored there may be some degradation there
Though that will more depend on the check being made and how the log is passed, if it does any heavy computations, etc
Is there any build process where the logging can be removed from certain parts?
like pre-processors....
You could probably do it with webpack if you wanted
that nice... I will explore that..
Yes, webpack's Uglify plugin has option drop_console...
But it seems it will drop direct usage of console.log...
So if Logger from NestJs is used, it may not be useful.
in c#, there are code level directive to group certain code that can be for specific build targets only..
#if DEBUG
#endif
The above directive do not take the code within in other than DEBUG build target.
Yeah, I don't know if that exists in Typescript
Logging is the only way to debug your application in production, you absolutely want logs there
Usualy, you lower the log level to disable DEBUG level logs though
Logs does have impact on performance if they are printed synchronouly to the console in the main thread. If that's an issue, you can look at Pino logger, which uses worker threads to print messages in batches, which drastically increases the speed (it really does!). Not sure if Ogma has that feature? (Maybe it's something you could look into @chilly lance )
Next major version of ogma will use the same sonic boom stream pino does which makes them almost equivalent in terms of performance