Documentation ¶
Index ¶
- func Error(r *http.Request, v ...any)
- func Errorf(r *http.Request, format string, v ...any)
- func Info(r *http.Request, v ...any)
- func Infof(r *http.Request, format string, v ...any)
- func StartHttp(host string, port int, handler http.Handler, opts ...StartOption) error
- func StartHttps(host string, port int, certFile, keyFile string, handler http.Handler, ...) error
- func WithLogCollector(ctx context.Context, lc *LogCollector) context.Context
- type LogCollector
- type StartOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartHttps ¶
func StartHttps(host string, port int, certFile, keyFile string, handler http.Handler, opts ...StartOption) error
StartHttps starts a https server.
func WithLogCollector ¶ added in v1.5.4
func WithLogCollector(ctx context.Context, lc *LogCollector) context.Context
WithLogCollector returns a new context with LogCollector.
Types ¶
type LogCollector ¶
type LogCollector struct { Messages []string // contains filtered or unexported fields }
LogCollector is used to collect logs.
func LogCollectorFromContext ¶ added in v1.5.4
func LogCollectorFromContext(ctx context.Context) *LogCollector
LogCollectorFromContext returns LogCollector from ctx.
func (*LogCollector) Append ¶
func (lc *LogCollector) Append(msg string)
Append appends msg into log context.
type StartOption ¶
StartOption defines the method to customize http.Server.
Click to show internal directories.
Click to hide internal directories.