Documentation ¶
Index ¶
- func BundleCrashReportFiles(ctx context.Context, maxReportCount int)
- func IsWriteInProgress(stateDir string) bool
- func ListUnUploadedCrashReports(stateDir string) []types.DiagnosticFile
- func ProcessPanic()
- func PurgeCrashReports(maxReportCount int)
- func Remove(reports ...string)
- func SetOptions(enabled bool, stateDir string, diagnosticFn diagnosticFunc)
- func SetupStderrRedirection()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BundleCrashReportFiles ¶
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 ¶
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 ¶
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.