Przeglądaj źródła

Log: mark Version

MaiXinRong 8 lat temu
rodzic
commit
96f88d83ed
2 zmienionych plików z 11 dodań i 1 usunięć
  1. 7 0
      Forms/MainFrm.pas
  2. 4 1
      Units/LogUtils.pas

+ 7 - 0
Forms/MainFrm.pas

@@ -224,6 +224,8 @@ type
     procedure ChangeLeftSideGlobalView(AIndex: Integer);
     function GetCurProjectFrame: TProjectFrame;
 
+    procedure OnError(ASender: TObject; AE: Exception);
+
     procedure ResetAutoSave;
   public
     procedure UpdateProgress(APos: Integer; const AHint: string);
@@ -860,4 +862,9 @@ begin
   ShellExecute(Application.Handle, nil, PChar(sHelpUrl), nil, nil, SW_SHOWNORMAL);
 end;
 
+procedure TMainForm.OnError(ASender: TObject; AE: Exception);
+begin
+  MeasureLog.AppendLogTo(AE.Message);
+end;
+
 end.

+ 4 - 1
Units/LogUtils.pas

@@ -10,6 +10,7 @@ type
   private
     FLogFolder: string;
     FLogFile: string;
+    FExeVersion: string;
   public
     constructor Create;
     destructor Destroy; override;
@@ -33,7 +34,7 @@ begin
       Append(f)
     else
       Rewrite(f);
-    Writeln(f, Format('%s %s', [DateTimeToStr(Now), ALog]));
+    Writeln(f, Format('[Version: %s] %s %s', [FExeVersion, DateTimeToStr(Now), ALog]));
     Flush(f);
   finally
     CloseFile(f);
@@ -50,6 +51,8 @@ begin
   if not DirectoryExists(FLogFolder) then
     CreateDirectoryInDeep(FLogFolder);
   FLogFile := FLogFolder + '\' + DateToStr(Date, vFormatSetting) + '.log';
+
+  FExeVersion := GetExeFileVersion(ParamStr(0));
 end;
 
 destructor TLogUtils.Destroy;