Skip to content

[lldb] Log swift-healthcheck messages to the system console #8691

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

Merged

Conversation

JDevlieghere
Copy link

This PR contains a series of cherrypicks from llvm.org in preparation for this change. The last commit uses the TeeLogHandler to multiplex swift-healthcheck messages to the system log so they're part of a sysdiagnose on Darwin.

…#83366)

Currently, calls to Host::SystemLog print to stderr on all host
platforms except Darwin. This severely limits its value on the command
line, where we don't want to overload the user with log messages. Switch
to using the syslog function on POSIX systems to send messages to the
system logger instead of stdout.

On Darwin systems this sends the log message to os_log, which matches
what we do today. Nevertheless I kept the current implementation that
uses os_log directly as it gives us more freedom.

I'm not sure if there's an equivalent on Windows, so I kept the existing
behavior of logging to stderr.

(cherry picked from commit 1b812f9)
Add the ability to specify a log level to Host::SystemLog.

(cherry picked from commit a7e9e3e)
We have 3 different enums all expressing severity (info, warning,
error). Remove all uses with a new Severity enum in lldb-enumerations.h.

(cherry picked from commit 528f5ba)
Always emit diagnostic events to the system log so that they end up in
the sysdiagnose on Darwin.

(cherry picked from commit f9d91fb)
Add a T-style log handler that multiplexes messages to two log handlers.
The goal is to use this in combination with the SystemLogHandler to log
messages both to the user requested file as well as the system log. The
latter is part of a sysdiagnose on Darwin which is commonly attached to
bug reports.

(cherry picked from commit a8fbe50)
@JDevlieghere
Copy link
Author

@swift-ci test

@JDevlieghere JDevlieghere merged commit b6c291f into swift/release/6.0 May 6, 2024
@JDevlieghere JDevlieghere deleted the jdevlieghere/swift-healthcheck-console branch May 6, 2024 14:27
@kastiglione
Copy link

thanks, looks great!

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.

3 participants