debug

package
v0.0.0-...-c039653 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: GPL-2.0 Imports: 18 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;
}
</style>
{{block "head" .}}{{end}}
</head>
<body>
<a href="/">Main</a>
<a href="/info">Info</a>
<a href="/memory">Memory</a>
<a href="/debug/">Debug</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,
})

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