Check-in [636a5f5ef3]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Moved ODS for OutputDebugString to separate unit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | updatecheck
Files: files | file ages | folders
SHA1: 636a5f5ef36aba10f6202ffdbd70afe35461134f
User & Date: tinus 2017-02-19 20:24:12
Context
2017-02-19
20:29
Moved ODS for OutputDebugString to separate unit. check-in: 3c4dc7f26d user: tinus tags: updatecheck
20:24
Moved ODS for OutputDebugString to separate unit. check-in: 636a5f5ef3 user: tinus tags: updatecheck
20:24
Moved ODS for OutputDebugString to separate unit. check-in: 24c1e8d83a user: tinus tags: updatecheck
Changes

Added src/Debug.pas.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
unit Debug;

interface

procedure ODS(const DebugOutput: string); overload;
procedure ODS(const DebugOutput: string; const Args: array of const); overload;

implementation
uses
  Classes, SysUtils,
  Windows,
  L_SpecialFolders;

var
  OutputLog: TStreamWriter;

{ ------------------------------------------------------------------------------------------------ }
procedure ODS(const DebugOutput: string); overload;
begin
  OutputDebugString(PChar('PreviewHTML['+IntToHex(GetCurrentThreadId, 4)+']: ' + DebugOutput));
  {$IFDEF DEBUG}
  if OutputLog = nil then begin
    OutputLog := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(TSpecialFolders.DLLFullName, '.log'), fmCreate or fmShareDenyWrite), TEncoding.UTF8);
    OutputLog.OwnStream;
    OutputLog.BaseStream.Seek(0, soFromEnd);
  end;
  OutputLog.Write(FormatDateTime('yyyy-MM-dd hh:nn:ss.zzz: ', Now));
  OutputLog.WriteLine(DebugOutput.Replace(#10, #10 + StringOfChar(' ', 25)));
  {$ENDIF}
end {ODS};
{ ------------------------------------------------------------------------------------------------ }
procedure ODS(const DebugOutput: string; const Args: array of const); overload;
begin
  ODS(Format(DebugOutput, Args));
end{ODS};


initialization

finalization
  OutputLog.Free;

end.