Skip to content

v2.0.0

Choose a tag to compare

@tristanls tristanls released this 27 Nov 18:23
· 7 commits to master since this release

This release breaks the API in a perhaps non-obvious way, hence MAJOR version bump to v2.0.0.

The API change revolves around the use case of calling log(level, message, custom) instead of the long form log(level, message, common, custom). Both, the v1 and v2 code base do not modify common parameter, but do mutate the custom parameter. The assumption being that common will be reused later in other calls, so changing it would have unexpected consequences, while custom was created per call to log(...) so it was ok to use it and mutate it directly.

What I (@tristanls) found in practice is that calling log(level, message, custom) does not occur in common usage. The much more often encountered pattern is log(level, message, common, {}), which I often mistakenly invoked via log(level, message, common).

Since log(level, message, custom) is hardly (if ever) used, v2.0.0 changes the API so that when log(...) is called with three parameters, the last parameter is interpreted as common instead of custom, as in log(level, message, common), and therefore will not be mutated in place but cloned/copied instead.