home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / delphi / unity / d56 / MJOURNAL.ZIP / Demo / Unit1.pas < prev   
Pascal/Delphi Source File  |  2002-08-29  |  1KB  |  57 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     procedure Button1Click(Sender: TObject);
  13.   private
  14.   public
  15.   end;
  16.  
  17. var
  18.   Form1: TForm1;
  19.  
  20. implementation
  21.  
  22. uses MiTeC_Journal;
  23.  
  24. var
  25.   Journal: TJournal;
  26.  
  27. {$R *.dfm}
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. var
  31.   i: Integer;
  32.   j: Double;
  33. begin
  34.   Journal.WriteEvent('First Level',elBegin);
  35.   Journal.WriteEventFmt('Called from %s',[TComponent(Sender).Name],elData);
  36.   Journal.WriteEvent('First Level',elEnd);
  37.   Journal.WriteEvent('Some action',elAction);
  38.   Journal.WriteEvent('Some info',elInformation);
  39.   Journal.WriteEvent('Another First Level',elBegin);
  40.   for i:=0 to 100000000 do
  41.     j:=Sqrt(i);
  42.   Journal.WriteEventFmt('Sqrt(%d)=%f',[i,j],elData);
  43.   Journal.WriteEvent('Some error',elError);
  44.   Journal.WriteEvent('Second Level',elBegin);
  45.   Journal.WriteEvent('Some warning',elWarning);
  46.   Journal.WriteEvent('Second Level',elEnd);
  47.   Journal.WriteEvent('First Level',elEnd);
  48. end;
  49.  
  50. initialization
  51.   Journal:=TJournal.Create(ExtractFilePath(Application.ExeName),
  52.                            ChangeFileExt(ExtractFilename(Application.ExeName),''),
  53.                            False,False,False);
  54. finalization
  55.   Journal.Free;
  56. end.
  57.