hedgewars/uUtils.pas
changeset 11748 eefa04b23c3b
parent 11637 cac74d9075be
child 11775 68f26b6a3a7d
--- a/hedgewars/uUtils.pas	Wed Apr 27 11:41:32 2016 +0200
+++ b/hedgewars/uUtils.pas	Wed Apr 27 13:01:38 2016 +0200
@@ -352,7 +352,10 @@
 {$IFDEF USE_VIDEO_RECORDING}
 EnterCriticalSection(logMutex);
 {$ENDIF}
-pfsWriteLn(logFile, inttostr(GameTicks)  + ': ' + s);
+if logFile <> nil then
+    pfsWriteLn(logFile, inttostr(GameTicks)  + ': ' + s)
+else
+    WriteLn(stdout, inttostr(GameTicks)  + ': ' + s);
 
 {$IFDEF USE_VIDEO_RECORDING}
 LeaveCriticalSection(logMutex);
@@ -544,6 +547,9 @@
             break;
         inc(i)
     end;
+
+    if logFile = nil then
+        WriteLn(stdout, '[WARNING] Could not open log file for writing. Log will be written to stdout!');
 {$ENDIF}
 
     //mobile stuff