DEADSOFTWARE

added headless mode
[d2df-sdl.git] / src / engine / e_log.pas
index e82bfb41149a0533db9173023bafbfe3cce249d2..e524c1a1a9f522e70191ef1543af9d132912e254 100644 (file)
@@ -15,6 +15,9 @@ procedure e_WriteLog(TextLine: String; RecordCategory: TRecordCategory;
                      WriteTime: Boolean = True);
 function DecodeIPV4(ip: LongWord): string;
 
+var
+  e_WriteToStdOut: Boolean = False;
+
 implementation
 
 var
@@ -33,6 +36,7 @@ procedure e_WriteLog(TextLine: String; RecordCategory: TRecordCategory;
 var
   LogFile: TextFile;
   Prefix: ShortString = '';
+  OutStr: String;
 begin
   if FileName = '' then Exit;
 
@@ -54,9 +58,12 @@ begin
         MSG_NOTIFY:     Prefix := '***';
       end;
       if WriteTime then
-        Writeln(LogFile, '['+TimeToStr(Time)+'] '+Prefix+' '+TextLine)
+        OutStr := '['+TimeToStr(Time)+'] '+Prefix+' '+TextLine
       else
-        Writeln(LogFile, Prefix+' '+TextLine);
+        OutStr := Prefix+' '+TextLine;  
+      Writeln(LogFile, OutStr);
+      if e_WriteToStdOut then
+        Writeln(OutStr);
     finally
       Close(LogFile);
     end;