debug

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	bytes.Buffer
	Style string
}

Info gathers debugging information and stores everything in a buffer in order to write it to somewhere later. It directly inherits a bytes.Buffer, so you can also use all these functions too.

func (*Info) AddGoroutineStack

func (di *Info) AddGoroutineStack()

AddGoroutineStack adds the current goroutine stack.

func (*Info) AddLastReportedModuleError

func (di *Info) AddLastReportedModuleError()

AddLastReportedModuleError adds the last reported module error, if one exists.

func (*Info) AddLastUnexpectedLogs

func (di *Info) AddLastUnexpectedLogs()

AddLastUnexpectedLogs adds the last 10 unexpected log lines, if any.

func (*Info) AddPlatformInfo

func (di *Info) AddPlatformInfo(ctx context.Context)

AddPlatformInfo adds OS and platform information.

func (*Info) AddSection

func (di *Info) AddSection(name string, flags InfoFlag, content ...string)

AddSection adds a debug section to the Info. The result is directly written into the buffer.

func (*Info) AddVersionInfo

func (di *Info) AddVersionInfo()

AddVersionInfo adds version information from the info pkg.

type InfoFlag

type InfoFlag int

InfoFlag defines possible options for adding sections to a Info.

const (
	// NoFlags does nothing.
	NoFlags InfoFlag = 0

	// UseCodeSection wraps the section content in a markdown code section.
	UseCodeSection InfoFlag = 1

	// AddContentLineBreaks adds a line breaks after each line of content,
	// except for the last.
	AddContentLineBreaks InfoFlag = 2
)

Jump to

Keyboard shortcuts

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