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

Improve logging in shell scripts #1293

Open
wants to merge 9 commits into
base: v5-0-0
Choose a base branch
from
Open

Conversation

LoicPoullain
Copy link
Member

@LoicPoullain LoicPoullain commented Aug 27, 2024

Issue

  • It is not possible to use a log context in shell scripts or any services called from a shell script.
  • When reading logs, it is not possible to aggregate logs through the execution of a given script as for an HTTP request.
  • When a script succeeds or fails, no message is logged.
  • Errors thrown in shell scripts are logged using console.error and not the logger which is not handy. When running a shell script in production, we may want to print the logs using a JSON format for example.

Solution and steps

  • Use logger.error instead of console.error in "npx foal run”
  • Allow to use log context in shell scripts
  • Add a script ID and the script name to log context when running a script
  • Log if script run completed or failed
  • Pass logger as third argument to the script

Checklist

  • Add/update/check docs (code comments and docs/ folder).
  • Add/update/check tests.
  • Update/check the cli generators.

@LoicPoullain LoicPoullain mentioned this pull request Aug 27, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Work In Progress
Development

Successfully merging this pull request may close these issues.

1 participant