loggerpro icon indicating copy to clipboard operation
loggerpro copied to clipboard

Feature request for automatic unwinding of chained exceptions

Open hderuiter opened this issue 6 years ago • 2 comments
trafficstars

Dear Daniel,

I just recently started using Delphi. Coming from a Java background, I definitely missed a decent logging framework, so I'm very glad you created LoggerPro. Thank you for your effort!

I was wondering if LoggerPro might support (in future editions) some kind of automatic nested exception unwinding (e.g. just passing the error object instead of a message). This way chained exceptions could be traced also.

Kind regards

hderuiter avatar May 13 '19 09:05 hderuiter

Hi, thank you for your kind words. Yes, it is planned, but I don't know when will be available.

danieleteti avatar May 13 '19 09:05 danieleteti

Thank you for your quick reply.

For now I implemented it externally in the following fashion:

  try
  // some stuff...
  except
      on E: Exception do
      begin

        var msg: string := E.Message;
        var ex: Exception := E.InnerException;

        while ex.InnerException <> nil do
        begin
           msg := msg + sLineBreak + #9 + ex.Message;
           ex := ex.InnerException;
        end;

        Log.Error('Could not process log %s [%s]', [canonicalFileName, msg], LOG_TAG);
      end;
  end;

hderuiter avatar May 13 '19 10:05 hderuiter