X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_log.pas;h=ed4cfe525f4479957cca8754c690a99be9f64b4c;hb=51bbf0eef2641d7766e22e188d6c349d9b836023;hp=3a8d0adc2900ef25e1f3fb3ea896c54320504e3e;hpb=ae4069ace642a386dd8651379dbfb0e6330d915b;p=d2df-sdl.git diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas index 3a8d0ad..ed4cfe5 100644 --- a/src/engine/e_log.pas +++ b/src/engine/e_log.pas @@ -41,6 +41,10 @@ function DecodeIPV4 (ip: LongWord): string; procedure e_InitWritelnDriver (); procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true); +procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true); + + +procedure e_WriteStackTrace (const msg: AnsiString); var @@ -70,6 +74,12 @@ begin end; +procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true); +begin + e_LogWritefln('%s', [s], category, writeTime); +end; + + // returns formatted string if `writerCB` is `nil`, empty string otherwise //function formatstrf (const fmt: AnsiString; args: array of const; writerCB: TFormatStrFCallback=nil): AnsiString; //TFormatStrFCallback = procedure (constref buf; len: SizeUInt); @@ -233,6 +243,24 @@ begin end; +{$I-} +procedure e_WriteStackTrace (const msg: AnsiString); +var + tfo: TextFile; +begin + e_LogWriteln(msg, MSG_FATALERROR); + if (Length(FileName) > 0) then + begin + if xlogFileOpened then CloseFile(xlogFile); + xlogFileOpened := false; + AssignFile(tfo, FileName); + Append(tfo); + if (IOResult <> 0) then Rewrite(tfo); + if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end; + end; +end; + + procedure e_DeinitLog (); begin if xlogFileOpened then CloseFile(xlogFile);