debug

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDebug

func DefaultDebug(o *Options)

默认,不需要调用

func ToBodyType

func ToBodyType(s string) color.BodyType

ToBodyType Returns the http body type, which mainly affects color highlighting

Types

type Apply

type Apply interface {
	Apply(*Options)
}

Apply is an interface for operating Options

func NoColor

func NoColor() Apply

NoColor Turn off color highlight debug mode

func OnlyTraceFlag

func OnlyTraceFlag() Apply

func ToFile

func ToFile(fileName string, color bool) Apply

第一个参数是要写入的文件名, 第二个参数是否颜色高亮

func ToWriter

func ToWriter(w io.Writer, color bool) Apply

第一个参数是要写入的io.Writer对象, 第二个参数是否颜色高亮

func Trace

func Trace() Apply

打开Trace()

type Func

type Func func(*Options)

Func Apply is a function that manipulates core data structures

func (Func) Apply

func (f Func) Apply(o *Options)

Apply is an interface for operating Options

type Options

type Options struct {
	EscapeHTML  bool
	Write       io.Writer
	Debug       bool
	Color       bool
	Trace       bool
	ReqBodyType string
	RspBodyType string
	TraceInfo
}

Options Debug mode core data structure

func (*Options) ResetBodyAndPrint

func (do *Options) ResetBodyAndPrint(req *http.Request, resp *http.Response) error

type TraceInfo

type TraceInfo struct {
	DnsDuration         time.Duration
	ConnDuration        time.Duration
	TLSDuration         time.Duration
	RequestDuration     time.Duration
	WaitResponeDuration time.Duration
	ResponseDuration    time.Duration
	TotalDuration       time.Duration
	// contains filtered or unexported fields
}

func (*TraceInfo) StartTrace

func (t *TraceInfo) StartTrace(opt *Options, needTrace bool, req *http.Request, do middler.Do) (*http.Response, error)

Jump to

Keyboard shortcuts

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