// See also: http://pastebin.com/36yMX1Mf - "how to get call stack for last exception" // See also: http://pastebin.com/ACtr0r6S - "how to silently log exception" // See also: http://pastebin.com/rdNbEwPH - "how to get call stack on demand" // Case 0: use StackTrace property of exception object (Delphi 2009+) except on E: Exception do Memo1.Lines.Text := E.StackTrace; end; // Case 1: use ToString method to convert call stack to single string with default formatting var CallStack: TEurekaBaseStackList; begin CallStack := ...; Memo1.Lines.Text := CallStack.ToString; end; // Case 2: use Assign method to convert call stack to TStrings object with default formatting var CallStack: TEurekaBaseStackList; begin CallStack := ...; Memo1.Lines.Assign(CallStack); end; // Case 3: use CallStackToString function // (CallStackToString function allows you to override header and formatting) var CallStack: TEurekaBaseStackList; Formatter: TCompactStackFormatter; begin CallStack := ...; // Default formatting and header: Memo1.Lines.Text := CallStackToString(CallStack); // Custom header: Memo1.Lines.Text := CallStackToString(CallStack, 'Error Details:'); // Custom formatting: Formatter := TCompactStackFormatter.Create; try // <- here you can customize Formatter (for example: alter captions for columns, etc.) Memo1.Lines.Text := CallStackToString(CallStack, '', Formatter); finally FreeAndNil(Formatter); end; end; // Case 4: use CallStackToStrings function // (CallStackToStrings function allows you to override header and formatting) var CallStack: TEurekaBaseStackList; Formatter: TCompactStackFormatter; begin CallStack := ...; // Default formatting and header: CallStackToStrings(CallStack, Memo1.Lines); // Custom header: CallStackToStrings(CallStack, Memo1.Lines, 'Error Details:'); // Custom formatting: Formatter := TCompactStackFormatter.Create; try // <- here you can customize Formatter (for example: alter captions for columns, etc.) CallStackToStrings(CallStack, Memo1.Lines, '', Formatter); finally FreeAndNil(Formatter); end; end; { Available build-in formatters for call stack are: - TEurekaStackFormatter - general formatter for EurekaLog-style call stack (i.e. fixed-width table with columns) - best to be used in text files - TEurekaStackFormatterV6 - backward-compatibility formatter to produce call stack in EurekaLog V6 format (less columns) - TSimpleStackFormatter - produces list-like view of call stack (no columns) suitable for variable-width fonts (best to be used in message boxes) - TCompactStackFormatter - similar to TSimpleStackFormatter, but produces more compact output with less details (good for quick preview) }