crashreport

package
v0.0.0-...-d79780e Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BundleCrashReportFiles

func BundleCrashReportFiles(ctx context.Context, maxReportCount int)

BundleCrashReportFiles creates a crash report archive with the current datetime in its name, then moves the previous stderr log file to it, and creates a flag file to prevent any upload, as the crash report is not complete (the flag will be removed once the diagnostic is created). It returns the path to the created crash report (or an empty string if not created).

func IsWriteInProgress

func IsWriteInProgress(stateDir string) bool

IsWriteInProgress returns whether a crash report is being written or not.

func ListUnUploadedCrashReports

func ListUnUploadedCrashReports(stateDir string) []types.DiagnosticFile

ListUnUploadedCrashReports returns all crash reports present in stateDir.

func ProcessPanic

func ProcessPanic()

ProcessPanic logs panics to Sentry. It should be deferred at the beginning of every new goroutine.

func PurgeCrashReports

func PurgeCrashReports(maxReportCount int)

PurgeCrashReports deletes oldest crash reports present in 'stateDir' and only keeps the 'maxReportCount' most recent ones.

func Remove

func Remove(reports ...string)

Remove deletes all the given crash reports from stateDir.

func SetOptions

func SetOptions(enabled bool, stateDir string, diagnosticFn diagnosticFunc)

SetOptions defines multiple things related to crash reporting: - enabled: whether crash reports should be created or not - stateDir: the directory where crash reports should be created - maxDirCount: the maximum number of crash reports we should keep in dir - diagnosticFn: a callback to generate diagnostics (might be nil if no diagnostic should be created).

func SetupStderrRedirection

func SetupStderrRedirection()

SetupStderrRedirection creates a file that will receive stderr output. If such a file already exists, it is moved to a work directory and the new and empty file takes its place.

Types

This section is empty.

Jump to

Keyboard shortcuts

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