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

Line-by-line logger #4

Merged
merged 6 commits into from
May 26, 2024
Merged

Line-by-line logger #4

merged 6 commits into from
May 26, 2024

Conversation

mmkal
Copy link
Owner

@mmkal mmkal commented May 26, 2024

Updated default logger.

Docs (from new readme):

  • Arrays will be logged line be line
  • For each line logged:
    • string, numbers and booleans are logged directly
    • objects are logged with JSON.stringify(___, null, 2)

So if the procedure returns ['one', 'two', 'three] this will be written to stdout:

one
two
three

If the procedure returns [{name: 'one'}, {name: 'two'}, {name: 'three'}] this will be written to stdout:

{
  "name": "one"
}
{
  "name": "two"
}
{
  "name": "three"
}

This is to make it as easy as possible to use with other command line tools like xargs, jq etc. via bash-piping. If you don't want to rely on this logging, you can always log inside your procedures however you like and avoid returning a value.

@mmkal mmkal merged commit e48e0dd into main May 26, 2024
1 check passed
@mmkal mmkal deleted the line-logger branch May 26, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant