debug

package
v0.0.0-...-53e5711 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlainText = PrintMode(iota)
	Markdown
	HTML
)

Variables

View Source
var BaseTemplate = template.Must(template.New("").Parse(`
<html>
<head>
<title>{{template "title" .}}</title>
<style>
.profile-name{
	display:inline-block;
	width:6rem;
}
td.value {
  text-align: right;
}
ul.events {
	list-style-type: none;
}

</style>
{{block "head" .}}{{end}}
</head>
<body>
<a href="/">Main</a>
<a href="/info">Info</a>
<a href="/memory">Memory</a>
<a href="/metrics">Metrics</a>
<a href="/rpc">RPC</a>
<a href="/trace">Trace</a>
<hr>
<h1>{{template "title" .}}</h1>
{{block "body" .}}
Unknown page
{{end}}
</body>
</html>

{{define "cachelink"}}<a href="/cache/{{.}}">Cache {{.}}</a>{{end}}
{{define "sessionlink"}}<a href="/session/{{.}}">Session {{.}}</a>{{end}}
{{define "viewlink"}}<a href="/view/{{.}}">View {{.}}</a>{{end}}
{{define "filelink"}}<a href="/file/{{.Session.ID}}/{{.Hash}}">{{.URI}}</a>{{end}}
`)).Funcs(template.FuncMap{
	"fuint64": fuint64,
	"fuint32": fuint32,
})
View Source
var Version = "v0.1.3"

Version is a manually-updated mechanism for tracking versions.

Functions

func AddCache

func AddCache(cache Cache)

AddCache adds a cache to the set being served

func AddSession

func AddSession(session Session)

AddSession adds a session to the set being served

func AddView

func AddView(view View)

AddView adds a view to the set being served

func DropCache

func DropCache(cache Cache)

DropCache drops a cache from the set being served

func DropSession

func DropSession(session Session)

DropSession drops a session from the set being served

func DropView

func DropView(view View)

DropView drops a view from the set being served

func PrintVersionInfo

func PrintVersionInfo(w io.Writer, verbose bool, mode PrintMode)

This writes the version and environment information to a writer.

func Render

func Render(tmpl *template.Template, fun func(*http.Request) interface{}) func(http.ResponseWriter, *http.Request)

func Serve

func Serve(ctx context.Context, addr string) error

Serve starts and runs a debug server in the background. It also logs the port the server starts on, to allow for :0 auto assigned ports.

Types

type Cache

type Cache interface {
	ID() string
	FileSet() *token.FileSet
}

type File

type File struct {
	Session Session
	URI     span.URI
	Data    string
	Error   error
	Hash    string
}

type PrintMode

type PrintMode int

type Session

type Session interface {
	ID() string
	Cache() Cache
	Files() []*File
	File(hash string) *File
}

type View

type View interface {
	ID() string
	Name() string
	Folder() span.URI
	Session() Session
}

Jump to

Keyboard shortcuts

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