Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Header = `crashreport
Use github.com/yehan2002/crashreport or open this file with any zip file viewer.
`
Header the header line to be used a crash report file. This text is written before the contents of the crash report
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.1.0
type Config struct { Reason []string NoStack bool NoSysInfo bool Profiles map[string]struct{} Files []string }
Config a struct containing config for creating a crash report.
type CrashReport ¶ added in v1.1.0
type CrashReport struct { // Profiles profiles included in the crash report Profiles []*Profile // SysInfo contains information about the system the process was running in. // This will be nil if [Config.NoSysInfo] is true or if the system.json does // not exist in the crash report file. SysInfo *SysInfo // Memstats memory usage statistics of the program. // This will be nil if memstats.json does not exist in the crash report file. Memstats *runtime.MemStats // Build contains build info embedded in the binary of the program. // This will be nil if the build.json does not exist in the crash report file. Build *debug.BuildInfo // Reason the reason the program crashed. Reason string // Stack the full stack trace of the program Stack string // Files extra files included in the crash report. Files []string }
CrashReport a crash report
func Create ¶ added in v1.1.0
func Create(c Config) (*CrashReport, error)
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile a profile
func NewProfile ¶ added in v1.1.0
func (*Profile) ProfileBytes ¶ added in v1.1.0
type Profiles ¶ added in v1.1.0
type Profiles uint8
Profiles the profiles to be included in the report
const ( ProfileHeap Profiles = 1 << iota ProfileBlock ProfileMutex ProfileAllocs ProfileGoroutines ProfileThreadCreate ProfileAll = ProfileHeap | ProfileBlock | ProfileMutex | ProfileAllocs | ProfileGoroutines | ProfileThreadCreate )
Profiles
type SysInfo ¶
type SysInfo struct { // Arch the running programs architecture target. // This is the value of [runtime.GOARCH] Arch string // OS the running programs operating system target. // This is the value of [runtime.OS] OS string // Compiler is the name of the compiler toolchain that built the running binary. Compiler string // GoVersion is the Go tree's version string. // It is either the commit hash and date at the time of the build or, // when possible, a release tag like "go1.3". GoVersion string // CPU is the number of logical CPUs usable by the process. // // The set of available CPUs is checked by querying the operating system // at process startup. Changes to operating system CPU allocation after // process startup are not reflected. CPU int // Goroutine the number of goroutines that existed at the time the crash report was created. Goroutines int // Thread the number of os the process was using when the crash report was created. Threads int // MaxCPU is the value of GOMAXPROCS. MaxCPU int // Time is the time when the crash report was created. Time time.Time // TimeStart is the time the program started running at. TimeStart time.Time // TimeRunning is the total amount of time the program was running. TimeRunning time.Duration }
SysInfo contains information about the system the process was running in.
Click to show internal directories.
Click to hide internal directories.