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

Use current-error-port for logging output #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

otherjoel
Copy link
Contributor

Although there is not universal agreement, there seems to be a long-standing doctrine of using stderr for logging output.

  • GNU’s Standard Streams, is often cited in discussions on this topic, which says stderr “is used for error messages and diagnostics issued by the program”. See, for example, this reddit thread.
  • Go and Python’s loggers send output to stderr by default.
  • How and when to use stdout and stderr? outlines the reasoning behind sending logging output to stderr.
  • For comparison, Pollen’s raco pollen start web server uses stderr for logging output.

This isn’t merely an ideological thing; there is one minor practical difference, which is that stdout is usually block-buffered by default while stderr is unbuffered. I did run into issues running raco static-web as a subprocess inside a GUI program due to this difference. On the other hand, this is something I can work around any number of ways, and others are very unlikely to be affected by stdout’s buffering behavior.

There would be one more significant practical difference, if raco-static-web had any non-logging “normal output” that would be likely to be piped to other programs, and which could be said to be polluted by the logging info. That doesn’t apply here, though it might in the future.

Anyway, this is just a suggestion, not something I have a strong opinion about, despite the lengthy explanation I am giving here.

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