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

Logger: ignore empty lines in JSON Mode #906

Merged
merged 3 commits into from
Mar 19, 2025

Conversation

josephjclark
Copy link
Collaborator

Short Description

In the logger, when running in json mode (ie, emit JSON objects, not strings), ignore anything with an empty message.

Fixes #899

Implementation Details

This PR is a little misleading because really what it does is prevents the worker sending empty log lines to Lightning.

But the implementation can be handled very neatly by the low level logging component. It'll simply not emit any empty log lines.

This makes sense: json logging is designed for tools to consume logs. And those tools don't need formatting log lines. Usually in the runtime we print empty lines to make the CLI pretty.

Note that console.log(undefined) will still log.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

@josephjclark
Copy link
Collaborator Author

@stuartc this should do you for empty log lines. Do you want to run any QA against this branch or would you rather we deploy to staging to see?

@josephjclark josephjclark changed the base branch from main to release/next March 14, 2025 15:50
@josephjclark josephjclark merged commit 0a176aa into release/next Mar 19, 2025
10 checks passed
@josephjclark josephjclark deleted the logger-json-blanks branch March 19, 2025 15:28
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 this pull request may close these issues.

Worker: don't send empty log lines
1 participant