Browse Source

* Allow creating a custom version of the event log class

git-svn-id: trunk@27790 -
michael 11 years ago
parent
commit
3a3e64e6df
1 changed files with 16 additions and 8 deletions
  1. 16 8
      packages/fcl-web/src/base/custweb.pp

+ 16 - 8
packages/fcl-web/src/base/custweb.pp

@@ -178,6 +178,7 @@ Type
     procedure DoOnTerminate(Sender : TObject);
     procedure DoOnTerminate(Sender : TObject);
   protected
   protected
     Procedure DoRun; override;
     Procedure DoRun; override;
+    Function CreateEventLog : TEventLog; virtual;
     function InitializeWebHandler: TWebHandler; virtual; abstract;
     function InitializeWebHandler: TWebHandler; virtual; abstract;
     Procedure DoLog(EventType: TEventType; const Msg: String); override;
     Procedure DoLog(EventType: TEventType; const Msg: String); override;
     procedure SetTitle(const AValue: string); override;
     procedure SetTitle(const AValue: string); override;
@@ -521,17 +522,24 @@ begin
   result := FWebHandler.Email;
   result := FWebHandler.Email;
 end;
 end;
 
 
-function TCustomWebApplication.GetEventLog: TEventLog;
+function TCustomWebApplication.CreateEventLog: TEventLog;
 begin
 begin
-  if not assigned(FEventLog) then
+  Result:=TEventLog.Create(Nil);
+  With Result do
     begin
     begin
-    FEventLog := TEventLog.Create(Nil);
-    FEventLog.Name:=Self.Name+'Logger';
-    FEventLog.Identification:=Title;
-    FEventLog.RegisterMessageFile(ParamStr(0));
-    FEventLog.LogType:=ltSystem;
-    FEventLog.Active:=True;
+    Name:=Self.Name+'Logger';
+    Identification:=Title;
+    RegisterMessageFile(ParamStr(0));
+    LogType:=ltSystem;
+    Active:=True;
     end;
     end;
+end;
+
+function TCustomWebApplication.GetEventLog: TEventLog;
+
+begin
+  if not assigned(FEventLog) then
+    FEventLog := CreateEventLog;
   Result := FEventLog;
   Result := FEventLog;
 end;
 end;