internal

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogContext = contextKey("request_logs")

LogContext is a context key.

Functions

func Error

func Error(r *http.Request, v ...interface{})

Error logs the given v along with r in error log.

func Errorf

func Errorf(r *http.Request, format string, v ...interface{})

Errorf logs the given v with format along with r in error log.

func Info

func Info(r *http.Request, v ...interface{})

Info logs the given v along with r in access log.

func Infof

func Infof(r *http.Request, format string, v ...interface{})

Infof logs the given v with format along with r in access log.

func StartHttp

func StartHttp(host string, port int, handler http.Handler) error

StartHttp starts a http server.

func StartHttps

func StartHttps(host string, port int, certFile, keyFile string, handler http.Handler) error

StartHttps starts a https server.

Types

type LogCollector

type LogCollector struct {
	Messages []string
	// contains filtered or unexported fields
}

A LogCollector is used to collect logs.

func (*LogCollector) Append

func (lc *LogCollector) Append(msg string)

Append appends msg into log context.

func (*LogCollector) Flush

func (lc *LogCollector) Flush() string

Flush flushes collected logs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL