Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // See also: http://pastebin.com/9P0PJcyc - "how to ignore particular exception"
- // See also: http://pastebin.com/XWpyDuw6 - "how to silently process exception"
- // See also: http://pastebin.com/QiicyV2E - "how to log all (handled) exceptions"
- // See also: http://pastebin.com/rdNbEwPH - "how to get call stack on demand"
- // See also: http://pastebin.com/46QkwZNi - "how to convert call stack to text"
- uses
- EException
- EExceptionManager,
- ELogBuilder,
- ESysInfo;
- // ...
- var
- EI: TEurekaExceptionInfo;
- begin
- try
- // ...
- except
- EI := ExceptionManager.LastThreadException;
- // or:
- EI := ExceptionManager.Info(ExceptObject, ExceptAddr);
- // or:
- on E: Exception do
- EI := ExceptionManager.Info(E);
- LogException(EI);
- end;
- ...
- procedure LogException(const AEI: TEurekaExceptionInfo);
- var
- LogBuilder: TBaseLogBuilder;
- LogFileName: String;
- begin
- // Create a generator for log content.
- // You may use default class for your application (LogBuilderClass)
- // Or a specific class (TLogBuilder, TXMLLogBuilder or your own descendant)
- LogBuilder := LogBuilderClass.Create(AEI);
- try
- // File name to save bug report to.
- // You may use AEI.BugIDStr, if you want to save each report into individual file.
- LogFileName := ExpandEnvVars(AEI.Options.OutputLogFile(''));
- // Generate and save bug report. File will be overwritten.
- LogBuilder.SaveToFile(LogFileName);
- finally
- FreeAndNil(LogBuilder);
- end;
- end;
- // This code will save bug report about exception to the specified file.
- // No other features will be invoked (such as dialogs, sending, duplicate/count merging, etc.)
- // If you want to process exception (like to get duplicate/count merging feature) - see: http://pastebin.com/XWpyDuw6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement