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

Pass errors are not only logged, but also printed again. #571

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

pdamme
Copy link
Collaborator

@pdamme pdamme commented Jul 10, 2023

  • For a long time, pass errors, which happen inside the DAPHNE compiler, used to be printed to std::cerr.
  • Since a recent commit (4a8f003), they are logged using the recently introduced logger, instead.
  • Not printing the error messages to std::cerr anymore has at least two significant downsides:
    • Users don't see the error messages anymore. Instead, DaphneDSL scripts may just silently fail.
    • The error output captured by our script-level test cases is useless, since it is empty.
  • This commit adds the printing of the error messages to std::cerr again, but also retains the logging of the errors.

@pdamme
Copy link
Collaborator Author

pdamme commented Jul 10, 2023

@corepointer Please let me know if there was a good reason to remove the printing of the error messages to std::cerr. I assume it was just a mishap, so I'm merging this myself now :) .

- For a long time, pass errors, which happen inside the DAPHNE compiler, used to be printed to std::cerr.
- Since a recent commit (4a8f003), they are logged using the recently introduced logger, instead.
- Not printing the error messages to std::cerr anymore has at least two significant downsides:
  - Users don't see the error messages anymore. Instead, DaphneDSL scripts may just silently fail.
  - The error output captured by our script-level test cases is useless, since it is empty.
- This commit adds the printing of the error messages to std::cerr again, but also retains the logging of the errors.
@pdamme pdamme force-pushed the log-and-print-pass-errors branch from 1824dbf to ee1a199 Compare July 10, 2023 16:00
@pdamme pdamme merged commit 5f73973 into main Jul 10, 2023
2 checks passed
@corepointer
Copy link
Collaborator

It was a partial mishap :-P I replaced std::cerr with spdlog::error on purpose but did a bad job in maintaining the expected behavior.

The ultimate goal of our logging facility is to remove these uncontrollable print outs (cout/cerr). I know some of our test cases rely on console output and the default logger configs that I set when merging it in are by far not in a solid state, but since the test cases completed without error when I tested I thought it's good enough for now.

Some things that come to my mind that would improve the situation:

  • Better defaults than log level OFF
  • a separate named logger that prints to std err and maybe can even avoid being muted by log_level_limit for exceptions and/or script errors
  • document when to require std err output

@pdamme
Copy link
Collaborator Author

pdamme commented Jul 22, 2023

Fair enough! For those who are interested: See #575 for more on that topic.

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.

2 participants