Class CrashHandler¶
Namespace: Apogee.Core.Diagnostics
Assembly: Apogee.Core.dll
Writes a crash report when an exception ends the program, and one for the previous run when it did not end cleanly. It sees managed exceptions only (crash-*.txt; the newest twenty are kept.
public static class CrashHandler
Inheritance¶
Inherited Members¶
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods¶
CheckPreviousRun(string)¶
The start of a run: the markers that earlier runs left in logDirectory (see
public static int CheckPreviousRun(string logDirectory)
Parameters¶
logDirectory string
Returns¶
The number of reports written.
Install(string, RecentLogSink)¶
Starts watching for unhandled exceptions. Reports go to reportDirectory (recent kept (add it to
public static void Install(string reportDirectory, RecentLogSink recent)
Parameters¶
reportDirectory string
recent RecentLogSink
SetContext(string, string)¶
Adds a line to the reports (key: value): the game, its version, the GPU. A key set again is replaced.
public static void SetContext(string key, string value)
Parameters¶
key string
value string
SetLogFile(IDisposable?)¶
The log file of the run: it is closed (and its marker removed) when an exception ends the program, since the crash has been reported by then. Null: none.
public static void SetLogFile(IDisposable? logFile)
Parameters¶
logFile IDisposable?
SetReportDirectory(string)¶
Moves the reports to another folder, once the game's own is known.
public static void SetReportDirectory(string reportDirectory)
Parameters¶
reportDirectory string
WriteReport(CrashKind, Exception?)¶
Writes a report now, with the lines
public static string? WriteReport(CrashKind kind, Exception? exception)
Parameters¶
kind CrashKind
exception Exception?
Returns¶
The path of the report; null when there is no folder yet, or the report could not be written (a line on stderr says why).