coblox / bobtimus

an autobot that automatically handles swaps as Bob
Apache License 2.0
1 stars 1 forks source link

Make use of parameters for calls to logging functions #57

Closed thomaseizinger closed 5 years ago

thomaseizinger commented 5 years ago

PR https://github.com/coblox/bobtimus/pull/55 introduced log4js into the codebase.

log4js is more powerful than debug and supports arbitrary parameters to its log-fn calls: https://github.com/log4js-node/log4js-node/blob/master/examples/example.js#L38

We should rewrite our log messages to make use of that because:

  1. That is how the API is supposed to be used
  2. Not doing so causes unnecessary string allocations (strings are immutable and hence cannot change). A template string therefore allocates a new string every time it is constructed. If the log level (f.e. TRACE) is not enabled, then the message was unnecessarily constructed.
thomaseizinger commented 5 years ago

Closed because to be done as part of #74.