- Timestamp:
- Jun 13, 2011, 8:21:12 AM (13 years ago)
- Location:
- Common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Common.lpk
r249 r251 6 6 <Author Value="Chronos (robie@centrum.cz)"/> 7 7 <CompilerOptions> 8 <Version Value=" 9"/>8 <Version Value="10"/> 9 9 <PathDelim Value="\"/> 10 10 <SearchPaths> … … 29 29 <Item3> 30 30 <Filename Value="UDebugLog.pas"/> 31 <HasRegisterProc Value="True"/> 31 32 <UnitName Value="UDebugLog"/> 32 33 </Item3> -
Common/Common.pas
r230 r251 8 8 9 9 uses 10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI,11 UThreading,LazarusPackageIntf;10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading, 11 LazarusPackageIntf; 12 12 13 13 implementation … … 15 15 procedure Register; 16 16 begin 17 RegisterUnit('UDebugLog', @UDebugLog.Register); 17 18 end; 18 19 -
Common/UDebugLog.pas
r250 r251 24 24 private 25 25 FFileName: string; 26 FMaxCount: Integer; 26 27 FOnNewItem: TNewItemEvent; 28 FWriteToFileEnable: Boolean; 29 procedure SetMaxCount(const AValue: Integer); 27 30 public 28 WriteToFileEnable: Boolean;29 31 Items: TThreadList; 30 MaxCount: Integer;31 32 procedure Add(Group: string; Text: string); 32 33 procedure WriteToFile(Text: string); 33 property OnNewItem: TNewItemEvent read FOnNewItem write FOnNewItem;34 34 constructor Create(AOwner: TComponent); override; 35 35 destructor Destroy; override; 36 36 published 37 property WriteToFileEnable: Boolean read FWriteToFileEnable 38 write FWriteToFileEnable; 37 39 property FileName: string read FFileName write FFileName; 40 property MaxCount: Integer read FMaxCount write SetMaxCount; 41 property OnNewItem: TNewItemEvent read FOnNewItem write FOnNewItem; 38 42 end; 39 43 40 var 41 DebugLog: TDebugLog; 44 procedure Register; 42 45 43 46 implementation 44 47 48 procedure Register; 49 begin 50 RegisterComponents('Common', [TDebugLog]); 51 end; 52 45 53 { TDebugLog } 54 55 procedure TDebugLog.SetMaxCount(const AValue: Integer); 56 var 57 List: TList; 58 I: Integer; 59 begin 60 if FMaxCount = AValue then Exit; 61 FMaxCount := AValue; 62 List := Items.LockList; 63 if List.Count > 0 then begin 64 for I := AValue to List.Count - 1 do 65 TDebugLogItem(List[I]).Free; 66 List.Count := AValue; 67 end; 68 Items.UnlockList; 69 end; 46 70 47 71 procedure TDebugLog.Add(Group: string; Text: string);
Note:
See TracChangeset
for help on using the changeset viewer.