Expose first-party errors on console #476
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This uses
simplelog
'sTerminalMode::Mixed
to send errors to stderr and other output to stdout. (It's also configurable in other interesting ways if we need.) Then it exposes errors on the console through systemd'sStandardError
setting.This is only done on first-party code where we control the error messages. We don't want to do this for third-party code that could spam the console; there's a performance impact for every message.
Related: as part of moving to
simplelog
, I clarified the confusion around number of-v
arguments by switching to an explicit--log-level
argument, e.g.--log-level info
, which is the default.Testing done:
With a normal "healthy" launch, only one additional message was output, from updog, and it's something that should be output. (We've since updated timestamp.json in the repo.)
If I have a fake setting like this in user data:
Then I get a moondog error in console:
You can see that it's the display representation of one of our error types that was printed before exiting moondog unsuccessfully.
Similarly, if I have invalid TOML in the user data:
If I run in qemu, we can see a couple more - updog and sundog failing because settings couldn't be generated:
Beyond those common cases... we don't actually have many error-level logs in our first-party code yet. This gives us the opportunity to add meaningful ones, though. And the types of errors we do get (in testing above) should be a big help to the debugging cases we've seen so far.