1 |
torben |
2671 |
// Upgraded to Delphi 2009: Sebastian Zierer
|
2 |
|
|
|
3 |
|
|
(* ***** BEGIN LICENSE BLOCK *****
|
4 |
|
|
* Version: MPL 1.1
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
7 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
8 |
|
|
* the License. You may obtain a copy of the License at
|
9 |
|
|
* http://www.mozilla.org/MPL/
|
10 |
|
|
*
|
11 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
12 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13 |
|
|
* for the specific language governing rights and limitations under the
|
14 |
|
|
* License.
|
15 |
|
|
*
|
16 |
|
|
* The Original Code is TurboPower SysTools
|
17 |
|
|
*
|
18 |
|
|
* The Initial Developer of the Original Code is
|
19 |
|
|
* TurboPower Software
|
20 |
|
|
*
|
21 |
|
|
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
22 |
|
|
* the Initial Developer. All Rights Reserved.
|
23 |
|
|
*
|
24 |
|
|
* Contributor(s):
|
25 |
|
|
*
|
26 |
|
|
* ***** END LICENSE BLOCK ***** *)
|
27 |
|
|
|
28 |
|
|
{*********************************************************}
|
29 |
|
|
{* SysTools: StExpLog.pas 4.04 *}
|
30 |
|
|
{*********************************************************}
|
31 |
|
|
{* SysTools: Exception Logging *}
|
32 |
|
|
{*********************************************************}
|
33 |
|
|
|
34 |
|
|
{$I StDefine.inc}
|
35 |
|
|
|
36 |
|
|
unit StExpLog;
|
37 |
|
|
|
38 |
|
|
interface
|
39 |
|
|
|
40 |
|
|
uses
|
41 |
|
|
Windows, SysUtils, Classes, StBase;
|
42 |
|
|
|
43 |
|
|
type
|
44 |
|
|
TStOnExceptionFilter = procedure(Sender : TObject; E : Exception;
|
45 |
|
|
var PutInLog : Boolean) of object;
|
46 |
|
|
|
47 |
|
|
TStExceptionLog = class(TStComponent)
|
48 |
|
|
private
|
49 |
|
|
{ Property variables }
|
50 |
|
|
FEnabled : Boolean;
|
51 |
|
|
FFileName : TFileName;
|
52 |
|
|
FRipInfo : string;
|
53 |
|
|
{ Event variables }
|
54 |
|
|
FOnExceptionFilter : TStOnExceptionFilter;
|
55 |
|
|
public
|
56 |
|
|
constructor Create(Owner : TComponent); override;
|
57 |
|
|
destructor Destroy; override;
|
58 |
|
|
procedure DoExceptionFilter(E : Exception; var PutInLog : Boolean); virtual;
|
59 |
|
|
published
|
60 |
|
|
{ Published properties }
|
61 |
|
|
property Enabled : Boolean read FEnabled write FEnabled default True;
|
62 |
|
|
property FileName : TFileName read FFileName write FFileName;
|
63 |
|
|
property RipInfo : string read FRipInfo write FRipInfo;
|
64 |
|
|
{ Published events }
|
65 |
|
|
property OnExceptionFilter : TStOnExceptionFilter
|
66 |
|
|
read FOnExceptionFilter write FOnExceptionFilter;
|
67 |
|
|
end;
|
68 |
|
|
|
69 |
|
|
const
|
70 |
|
|
ExpLog : TStExceptionLog = nil;
|
71 |
|
|
|
72 |
|
|
implementation
|
73 |
|
|
|
74 |
|
|
{ TStExceptionLog }
|
75 |
|
|
|
76 |
|
|
constructor TStExceptionLog.Create(Owner : TComponent);
|
77 |
|
|
begin
|
78 |
|
|
inherited Create(Owner);
|
79 |
|
|
ExpLog := Self;
|
80 |
|
|
FEnabled := True;
|
81 |
|
|
end;
|
82 |
|
|
|
83 |
|
|
destructor TStExceptionLog.Destroy;
|
84 |
|
|
begin
|
85 |
|
|
ExpLog := nil;
|
86 |
|
|
inherited;
|
87 |
|
|
end;
|
88 |
|
|
|
89 |
|
|
procedure TStExceptionLog.DoExceptionFilter(E : Exception; var PutInLog : Boolean);
|
90 |
|
|
begin
|
91 |
|
|
if Assigned(FOnExceptionFilter) then
|
92 |
|
|
FOnExceptionFilter(Self, E, PutInLog);
|
93 |
|
|
end;
|
94 |
|
|
|
95 |
|
|
initialization
|
96 |
|
|
|
97 |
|
|
end.
|