mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-10 05:46:03 +00:00
920b07853a
Sinceee56f37713
, any deployment hook that was using simple `console.log()` statements to output information, would result in unexpected `[[object object], [object object]]`. Unfortunately, the reason for that was that we switched from non-arrow functions to arrow functions [here](ee56f37713 (diff-a7c4cef8bfebeb39fcd092aca5570fecL324-L340)
). Usually switching from non-arrow functions to arrow functions solves a lot of lexical scope issues where the current reference of `this` isn't pointing at the right thing. We're tempering with the global `console.log` inside Embark, which then, combined with **proper** lexical scope, causes the output described above. Generally there are a few ways to go about this: 1. Ensure that our custom log functions doesn't turn every log statement into an array output 2. Tell users not to use `console.log` inside deployment hooks and instead rely on `deps.logger` 3. Revert the changes made in the mentioned commit and use non-arrow functions inside `interceptLogs` Option 2) is not really a solution as we can't simply tell our users that they can't use one of the most used functions in JavaScript. Option 1) requires finding out why we're formatting logs by default in an array shapre in the first place. On top of that, we might be relying on this inside Embark, so it could break certain output. Option 3) seems to be the most pragmatic solution for now as it doesn't introduce any of the downsides mentioned above at the cost of using non-arrow functions.