-
Notifications
You must be signed in to change notification settings - Fork 284
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
Log proper names for POSIX signals #6228
Conversation
d32a9fb
to
c16e2cb
Compare
ca71749
to
7cca110
Compare
7cca110
to
4580f04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the string_of_signal
is unused after the second commit, or is it? Planning to squash it?
Yes, it's completely deleted by the second commit. I'm not planning on squashing it |
The integer values that OCaml uses for signals should never be printed as they are. They can cause confusion because they don't match the C POSIX values. Change the unixext function that converts them to string to stop building a list and finding a value in the list to instead use pattern-matching. Also added some more values that got introduced in OCaml 4.03, and return a more compact value for unknown signals, following the same format as Fmt.Dump.signal Signed-off-by: Pau Ruiz Safont <[email protected]>
When signals are are written to logs, the POSIX name should be used to minimize confusion. It makes sense that the function that does this is in the logging library instead of the unix one, as most users will be already be using the logging library, but not all the unix one. Moving it there also allows for a more ergonomic usage with the logging functions. Signed-off-by: Pau Ruiz Safont <[email protected]>
4580f04
to
c0fbb69
Compare
@@ -353,4 +353,8 @@ functor | |||
with e -> log_backtrace_internal ~level:Syslog.Debug ~msg:"debug" e () | |||
end | |||
|
|||
module Pp = struct let mtime_span () = Fmt.str "%a" Mtime.Span.pp end | |||
module Pp = struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have liked PP
or Pretty
better - but it already exists.
Can we merge this? |
The integer values that OCaml uses for signals should never be printed as integers. They can cause confusion because they don't match the C POSIX values.
Change the unixext function that converts them to string to stop building a list and finding a value in the list to instead use pattern-matching. Also added some more values that got introduced in OCaml 4.03, and return a more compact value for unknown signals, following the same format as Fmt.Dump.signal.
Typically, engineers see signal -11 and assume it's SIGSEGV, when it's SIGTERM.
Fixes #6225