Added loacal logfile logging
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5663 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
f53d049c85
commit
48ec6d54fe
@ -4,13 +4,13 @@
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Win32"/>
|
||||
<Units Count="16">
|
||||
<Units Count="17">
|
||||
<Unit0>
|
||||
<Filename Value="testapp.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<CursorPos X="33" Y="27"/>
|
||||
<UsageCount Value="43"/>
|
||||
<UsageCount Value="44"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -20,40 +20,40 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="32"/>
|
||||
<CursorPos X="103" Y="53"/>
|
||||
<UsageCount Value="43"/>
|
||||
<TopLine Value="64"/>
|
||||
<CursorPos X="19" Y="103"/>
|
||||
<UsageCount Value="44"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="3"/>
|
||||
<CursorPos X="76" Y="8"/>
|
||||
<UsageCount Value="26"/>
|
||||
<UsageCount Value="27"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\lazautoupdate_httpclient.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="97" Y="12"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="349"/>
|
||||
<CursorPos X="21" Y="364"/>
|
||||
<TopLine Value="352"/>
|
||||
<CursorPos X="46" Y="373"/>
|
||||
<ExtraEditorCount Value="2"/>
|
||||
<ExtraEditor1>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="1141"/>
|
||||
<CursorPos X="11" Y="1231"/>
|
||||
<TopLine Value="1145"/>
|
||||
<CursorPos X="11" Y="1235"/>
|
||||
</ExtraEditor1>
|
||||
<ExtraEditor2>
|
||||
<EditorIndex Value="-1"/>
|
||||
@ -61,7 +61,7 @@
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
</ExtraEditor2>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
@ -105,7 +105,7 @@
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="25"/>
|
||||
<CursorPos X="25" Y="55"/>
|
||||
<UsageCount Value="18"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
@ -120,7 +120,7 @@
|
||||
<EditorIndex Value="4"/>
|
||||
<TopLine Value="25"/>
|
||||
<CursorPos X="71" Y="44"/>
|
||||
<UsageCount Value="15"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
@ -144,6 +144,15 @@
|
||||
<TopLine Value="372"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="..\updatehmsource\updatehm.lpr"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="35"/>
|
||||
<CursorPos X="40" Y="51"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit16>
|
||||
</Units>
|
||||
<General>
|
||||
<ActiveWindowIndexAtStart Value="1"/>
|
||||
@ -151,87 +160,87 @@
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="51" Column="20" TopLine="35"/>
|
||||
<Caret Line="56" Column="27" TopLine="28"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="914" TopLine="893"/>
|
||||
<Caret Line="533" Column="45" TopLine="519"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1076" TopLine="1039"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="16"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="180" Column="33" TopLine="157"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="13" Column="43" TopLine="12"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="76" Column="3" TopLine="74"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="14" TopLine="3"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="129" Column="3" TopLine="92"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="22" TopLine="3"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="122" Column="3" TopLine="92"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="20" Column="7" TopLine="7"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="56" Column="27" TopLine="28"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="25"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="533" Column="45" TopLine="519"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="24"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="16"/>
|
||||
<Caret Line="25"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="13" Column="43" TopLine="12"/>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="26" Column="8" TopLine="2"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="14" TopLine="3"/>
|
||||
<Caret Line="16" TopLine="3"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="22" TopLine="3"/>
|
||||
<Caret Line="26" Column="2" TopLine="5"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="20" Column="7" TopLine="7"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="56" Column="27" TopLine="28"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="25"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="52" Column="19" TopLine="28"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="24"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="56" Column="19" TopLine="28"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="25"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="926" Column="38" TopLine="889"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="26" Column="8" TopLine="2"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="55" Column="27" TopLine="29"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="16" TopLine="3"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="926" Column="38" TopLine="892"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\open_ssl.pas"/>
|
||||
<Caret Line="26" Column="2" TopLine="5"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1083" Column="39" TopLine="1045"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="56" Column="27" TopLine="28"/>
|
||||
<Caret Line="51" Column="22" TopLine="28"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
@ -239,35 +248,35 @@
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="56" Column="19" TopLine="28"/>
|
||||
<Caret Line="55" Column="19" TopLine="28"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="926" Column="38" TopLine="889"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="53" Column="103" TopLine="32"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="55" Column="27" TopLine="29"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="82" Column="9" TopLine="47"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="926" Column="38" TopLine="892"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="89" Column="30" TopLine="58"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1083" Column="39" TopLine="1045"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="15" Column="23"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="51" Column="22" TopLine="28"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="79" Column="26" TopLine="53"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="52" Column="19" TopLine="28"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="157" Column="94" TopLine="115"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="55" Column="19" TopLine="28"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="95" TopLine="64"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
@ -1,7 +1,7 @@
|
||||
object mainform: Tmainform
|
||||
Left = 682
|
||||
Left = 558
|
||||
Height = 209
|
||||
Top = 277
|
||||
Top = 210
|
||||
Width = 335
|
||||
BorderIcons = [biSystemMenu]
|
||||
Caption = 'mainform'
|
||||
@ -9,6 +9,7 @@ object mainform: Tmainform
|
||||
ClientWidth = 335
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
Position = poDesktopCenter
|
||||
LCLVersion = '1.7'
|
||||
Visible = True
|
||||
|
@ -6,26 +6,31 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, ComCtrls,
|
||||
Buttons, StdCtrls,ulazautoupdate;
|
||||
Buttons, StdCtrls,LazFileUtils,FileUtil,
|
||||
ulazautoupdate,eventlog;
|
||||
CONST
|
||||
{$IFDEF WINDOWS}
|
||||
{$IFDEF CPU32}
|
||||
C_VERSIONSINNAME = 'testappwin32.ini';
|
||||
C_ZIPFILENAME = 'testappwin32.zip';
|
||||
C_LogFileName = 'testappwin32log.txt';
|
||||
{$ENDIF}
|
||||
{$IFDEF CPU64}
|
||||
C_VERSIONSINNAME = 'testappwin64.ini';
|
||||
C_ZIPFILENAME = 'testappwin64.zip';
|
||||
C_LogFileName = 'testappwin64log.txt';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF LINUX}
|
||||
{$IFDEF CPU32}
|
||||
C_VERSIONSINNAME = 'testapplinux32.ini';
|
||||
C_ZIPFILENAME = 'testapplinux32.zip';
|
||||
C_LogFileName = 'testapplinux32log.txt';
|
||||
{$ENDIF}
|
||||
{$IFDEF CPU64}
|
||||
C_VERSIONSINNAME = 'testapplinux64.ini';
|
||||
C_ZIPFILENAME = 'testapplinux64.zip';
|
||||
C_LogFileName = 'testapplinux64log.txt';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
@ -50,6 +55,7 @@ type
|
||||
procedure cmd_updateToNewVersionClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName,
|
||||
lauMessage: string);
|
||||
procedure LazAutoUpdate1Downloaded(Sender: TObject; ResultCode,
|
||||
@ -57,7 +63,8 @@ type
|
||||
procedure LazAutoUpdate1NewVersionAvailable(Sender: TObject;
|
||||
Newer: boolean; OnlineVersion: string);
|
||||
private
|
||||
|
||||
Logger: TEventLog;
|
||||
procedure WriteAndLog(szText: string);
|
||||
public
|
||||
|
||||
end;
|
||||
@ -70,6 +77,10 @@ implementation
|
||||
{$R *.lfm}
|
||||
|
||||
{ Tmainform }
|
||||
procedure Tmainform.WriteAndLog(szText: string);
|
||||
begin
|
||||
Logger.Info(szText);
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormCreate(Sender: TObject);
|
||||
begin
|
||||
@ -78,6 +89,19 @@ begin
|
||||
LazAutoUpdate1.ZipfileName:=C_ZIPFILENAME;
|
||||
lbl_Version.Caption:='Version: ' + LazAutoUpdate1.AppVersion;
|
||||
Caption:=Application.Title;
|
||||
if FileExistsUTF8(C_LogFileName) then
|
||||
DeleteFile(C_LogFileName);
|
||||
Logger := TEventLog.Create(nil);
|
||||
Logger.LogType := ltFile;
|
||||
Logger.FileName := C_LogFileName;
|
||||
Logger.Active := True;
|
||||
Logger.Info('Start of Log');
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
Logger.Info('End of Log');
|
||||
FreeAndNil(Logger);
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmd_NewVersionAvailableClick(Sender: TObject);
|
||||
@ -114,6 +138,7 @@ procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName,
|
||||
lauMessage: string);
|
||||
begin
|
||||
StatusBar1.SimpleText:='Debug Message: (' + lauMethodName + ') ' + lauMessage;
|
||||
WriteAndLog(StatusBar1.SimpleText);
|
||||
end;
|
||||
|
||||
procedure Tmainform.LazAutoUpdate1Downloaded(Sender: TObject; ResultCode,
|
||||
@ -121,6 +146,7 @@ procedure Tmainform.LazAutoUpdate1Downloaded(Sender: TObject; ResultCode,
|
||||
begin
|
||||
StatusBar1.SimpleText:=Format('Downloaded. StatusCode=%d BytesDownloaded=%d',
|
||||
[ResultCode,BytesDownloaded]);
|
||||
WriteAndLog(StatusBar1.SimpleText);
|
||||
end;
|
||||
|
||||
procedure Tmainform.LazAutoUpdate1NewVersionAvailable(Sender: TObject;
|
||||
@ -129,7 +155,9 @@ begin
|
||||
If Newer then
|
||||
StatusBar1.SimpleText:='New version available. Online Version is ' + OnlineVersion
|
||||
else
|
||||
StatusBar1.SimpleText:='Online version is not newer. Online Version is ' + OnlineVersion
|
||||
StatusBar1.SimpleText:='Online version is not newer. Online Version is ' + OnlineVersion;
|
||||
|
||||
WriteAndLog(StatusBar1.SimpleText);
|
||||
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user