Fixed issue with logging of task name to stdout#58
Conversation
Codecov Report
@@ Coverage Diff @@
## master #58 +/- ##
=======================================
Coverage 80.64% 80.64%
=======================================
Files 36 36
Lines 806 806
Branches 99 99
=======================================
Hits 650 650
Misses 156 156
Continue to review full report at Codecov.
|
lib/orchestrators/join.js
Outdated
| // TODO better checking if task/join/junction/fork | ||
| if (task.info) { | ||
| console.log('Joining to task: ' + task.info.name) | ||
| if (task.info.props) { |
There was a problem hiding this comment.
we can consider using lodash.get for things like this (_.get(task, 'info.props') since then we wont have runtime errors like cannot get property props of undefined (if task.info does not exist)
at the same time, all properties on the task state object should be declared in the initial state (i.e. what the default value is for state in the reducer (state, action)
There was a problem hiding this comment.
So, if I do console.log('Joining to task: ' + _.get(task, 'info.props.name')) it seems to be similar to what it was previously, but without the problem of task.info being undefined and breaking the run before it ended, right?
lib/orchestrators/join.js
Outdated
| if (task.info) { | ||
| console.log('Joining to task: ' + task.info.name) | ||
| if (task.info.props) { | ||
| console.log('Joining to task: ' + task.info.props.name) |
There was a problem hiding this comment.
is the logging function available to use here? we can do something like
logger.emit('debug', `Joining to task: ${task.info.props.name}`)That way we can later have stdout be filtered with CLI options, like --debug to enable more verbose debugging
logger is generally passed into a function as a param (with a preset tab size), see search: logger
(we can reconsider the logger if it is overly complicated - automated indenting was tricky and perhaps not worth the complexity)
|
@tiagofilipe12 ready to merge? |
Previously
console.log('Joining to task: ' + task.info.name)would render something like:Joining to task: undefined. However, the task name is stored intask.info.props.nameinstead.