danieleteti/loggerpro

Feature request for automatic unwinding of chained exceptions

Opened this issue · 2 comments

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

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

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;