Documentation ¶
Index ¶
- func Error(r *fasthttp.RequestCtx, v ...any)
- func Errorf(r *fasthttp.RequestCtx, format string, v ...any)
- func Info(r *fasthttp.RequestCtx, v ...any)
- func Infof(r *fasthttp.RequestCtx, format string, v ...any)
- func SetLogCollector(ctx *fasthttp.RequestCtx, lc *LogCollector) (free func())
- func StartHttp(host string, port int, handler fasthttp.RequestHandler, opts ...StartOption) error
- func StartHttps(host string, port int, certFile, keyFile string, ...) error
- type LogCollector
- type StartOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(r *fasthttp.RequestCtx, v ...any)
Error logs the given v along with r in error log.
func Errorf ¶
func Errorf(r *fasthttp.RequestCtx, format string, v ...any)
Errorf logs the given v with format along with r in error log.
func Info ¶
func Info(r *fasthttp.RequestCtx, v ...any)
Info logs the given v along with r in access log.
func Infof ¶
func Infof(r *fasthttp.RequestCtx, format string, v ...any)
Infof logs the given v with format along with r in access log.
func SetLogCollector ¶
func SetLogCollector(ctx *fasthttp.RequestCtx, lc *LogCollector) (free func())
SetLogCollector returns a new context with LogCollector.
func StartHttp ¶
func StartHttp(host string, port int, handler fasthttp.RequestHandler, opts ...StartOption) error
StartHttp starts a http server.
func StartHttps ¶
func StartHttps(host string, port int, certFile, keyFile string, handler fasthttp.RequestHandler, opts ...StartOption) error
StartHttps starts a https server.
Types ¶
type LogCollector ¶
type LogCollector struct { Messages []string // contains filtered or unexported fields }
LogCollector is used to collect logs.
func LogCollectorFromContext ¶
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.