debug

package module
v0.0.0-...-f528a66 Latest Latest
Warning

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

Go to latest
Published: May 26, 2017 License: BSD-3-Clause Imports: 5 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

debug CircleCI

Middleware debug is a debug middleware for Tango.

Installation

go get github.com/tango-contrib/debug

Simple Example

type DebugAction struct {
    tango.Ctx
}

func (c *DebugAction) Get() {
    c.Write([]byte("get"))
}

func main() {
    t := tango.Classic()
    t.Use(debug.Debug())
    t.Get("/", new(DebugAction))
    t.Run()
}

When you run this, then you will find debug info on console or log file, it will show you the request detail info and response detail.

[tango] 2015/03/04 06:44:06 [Debug] debug.go:53 [debug] request: GET http://localhost:3000/
[tango] 2015/03/04 06:44:06 [Debug] debug.go:55 [debug] head: map[]
[tango] 2015/03/04 06:44:06 [Debug] debug.go:66 [debug] ----------------------- end request
[tango] 2015/03/04 06:44:06 [Debug] debug.go:78 [debug] response ------------------ 200
[tango] 2015/03/04 06:44:06 [Debug] debug.go:80 [debug] head: map[]
[tango] 2015/03/04 06:44:06 [Debug] debug.go:83 [debug] body: debug
[tango] 2015/03/04 06:44:06 [Debug] debug.go:85 [debug] ----------------------- end response

License

This project is under BSD License. See the LICENSE file for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(options ...Options) tango.HandlerFunc

Types

type Options

type Options struct {
	HideRequest         bool
	HideRequestHead     bool
	HideRequestBody     bool
	HideResponse        bool
	HideResponseHead    bool
	HideResponseBody    bool
	IgnorePrefix        string
	IgnoreContentTypes  []string
	HideRequestBodyFunc func(http.Header) bool
}

Jump to

Keyboard shortcuts

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