Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements http.Handler interface that will recover from panic and return appropriate HTTP response, log and notify on such event.
type NotifierFunc ¶
NotifierFunc type is an adapter to allow the use of ordinary functions as Notifier.
func (NotifierFunc) Notify ¶
func (f NotifierFunc) Notify(subject, body string) error
Notify calls NotifierFunc(subject, body).
type Option ¶
type Option func(*Handler)
Option is a function that sets optional parameters to the Handler.
func WithLabel ¶
WithLabel sets a string that will be included in log message and notification. Usually, it contains the name of the server and its version.
func WithLogger ¶ added in v0.8.0
WithLogger sets the function that will perform message logging. Default is slog.Default().
func WithNotifier ¶
WithNotifier sets the function that takes subject and body arguments and is intended for sending notifications.
func WithPanicResponse ¶
WithPanicResponse sets a fixed body and its content type HTTP header that will be returned as HTTP response on panic event. If WithPanicResponseHandler is defined, this options are ignored.
func WithPanicResponseHandler ¶
WithPanicResponseHandler sets http.Handler that will be executed on panic event. It is useful when the response has dynamic content. If the content is static it is better to use WithPanicResponse option instead. This option has a precedence upon WithPanicResponse.