DiscardAfterClose is an io.WriteCloser that discards writes after it is closed without errors.
It is useful as a target for a slog.Sink such that an underlying WriteCloser, like a file, can
be cleaned up without race conditions from still-active loggers.
Hostname returns the hostname of the machine, lowercased,
with any trailing domain suffix stripped.
It is cached after the first call.
If the hostname cannot be determined, for any reason,
localhost will be returned instead.