-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: new log task to replace echo task #1055
Conversation
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.
You should also remove old the usage of the deprecated Task on the core (java + yaml), If we want to properly remove one day the task
0f6a784
to
320c925
Compare
32aa057
to
9cda02c
Compare
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.
Can you add something in the description of the Echo task to say that it's deprecated and replaced by the new Log task ?
@Getter | ||
@NoArgsConstructor | ||
@Schema( | ||
title = "Simple debugging task that log a renderer value.", |
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.
title = "Simple debugging task that log a renderer value.", | |
title = "Task that log a message in the execution log.", |
description = "This task is mostly useful for debugging purpose.\n\n" + | ||
"This one allow you to logs inputs or outputs variables for example, or to debug some templated functions." |
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.
I think you can remove this description, people know the purpose of a log
description = "Can be a string or an array of string", | ||
anyOf = { | ||
String.class, | ||
ArrayList.class |
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.
ArrayList.class | |
String[].class |
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.
Thanks to this the JSON schema will know that the item in the list must be strings
String render = runContext.render((String) this.message); | ||
this.log(logger, this.level, render); | ||
} else if (this.message instanceof Collection) { | ||
ArrayList<String> messages = (ArrayList<String>) this.message; |
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.
ArrayList<String> messages = (ArrayList<String>) this.message; | |
Collection<String> messages = (Collection<String>) this.message; |
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.
Don't cast on implementation, always prefere to use the interface.
If Collection didn't fit, use List instead.
It's a principle called "coding against interface"
@@ -0,0 +1,116 @@ | |||
package io.kestra.core.tasks.debugs; |
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.
Should be in the log package not the debug package (the same where the Fetch task will be)
Write a new log task with a more explicit property that accepts String but also an Array of String.
No tests were written for the echo task. Should I write one for the log task?
close #1046