exilon / QuickLogger

Powerful and flexible library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Apache License 2.0
373 stars 84 forks source link

how to cath stack trace info? #43

Open kevinsui581 opened 4 years ago

kevinsui581 commented 4 years ago

i have include iiExceptionInfo, iiExceptionStackTrace, in sentry,can not find stack trace info!

kevinsui581 commented 4 years ago

I have read source code, but can't found send stacktrace info to sentry; I add jcldebug into my project, so it can create stack trace info, i want to know how to send the stack trace info with quick logger to sentry?

vesnx commented 2 months ago

Try the Jedi library

procedure LogException(const E: Exception);
var
  msg: string;
  StackTrace: string;
begin

  if not IsNullOrEmpty(E.StackTrace) then
    StackTrace := E.StackTrace
  else
  begin
   {$IFDEF MSWINDOWS}
   {$IFDEF JclDebugEnabled }
     var list := TStringList.Create;
     try
        JclLastExceptStackListToStrings(list,True, True, True, False);
        StackTrace := list.Text;
     finally
        list.Free;
     end;
     {$ENDIF}
     {$ENDIF}
  end;

  msg := Format('%s: %s on %s', [E.ClassName, E.Message,StackTrace]);
  Log(msg, etException);
end;