Skip to content
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

Worker: don't send empty log lines #899

Closed
josephjclark opened this issue Mar 10, 2025 · 1 comment · Fixed by #906
Closed

Worker: don't send empty log lines #899

josephjclark opened this issue Mar 10, 2025 · 1 comment · Fixed by #906
Assignees

Comments

@josephjclark
Copy link
Collaborator

Don't send empty log lines to Lightning. Do send console.log(undefined), especially in job code, because it might be important.

From discussion at: OpenFn/lightning#2959

  • In the job logger - the thing that logs user's console.log statements - I could (probably) detect an undefined value and pass an 'undefined' string instead. Now Lightning will receive message: ['undefined']. I don't know if that will confuse anything. I suppose I could also do message: [undefined] if an argument was passed, which is probably more useful

  • The logger has console.break() function, which I think is mostly what the CLI uses for this. I could have a rule like: when logging json output, ignore any console.break statements - because we assume that the JSON will be consumed by something richer that a terminal downstream.
    The worker could refuse to send any logs with message: [] on the assumption that it's a waste of everyone's time
    If I do that, then I think I can promise:

  • message: [undefined] is useful and even important to log
    *You will not be sent meaningless empty lines which are just stdout padding

@josephjclark josephjclark self-assigned this Mar 10, 2025
@github-project-automation github-project-automation bot moved this to New Issues in v2 Mar 10, 2025
@josephjclark josephjclark moved this from New Issues to Ready in v2 Mar 10, 2025
@josephjclark
Copy link
Collaborator Author

I promised this to Stu last month and haven't done it. Hoping to pick this up this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant