New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -17,10 +17,11 @@ const join = (dispatch) => { | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -17,10 +17,11 @@ const join = (dispatch) => { | |||
|
|||
// TODO better checking if task/join/junction/fork | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.name
instead.