Difference between revisions of "LMD LogTools tutorial"
Line 8: | Line 8: | ||
... | ... | ||
− | LMDLog.SendString(Test, 'Hello, World!'); | + | LMDLog.SendString('Test', 'Hello, World!'); |
... | ... | ||
</delphi> | </delphi> | ||
+ | |||
+ | |||
+ | |||
+ | TLMDLogSession class has methods to send some info into main log - TLMDLogSession.Send*, to watch data in Watch area - TLMDLogSession.Watch* (main different with Send* function that Watch* has just changed value of watched variables, but not add new record) | ||
+ | |||
+ | <delphi> | ||
+ | uses | ||
+ | ..., LMDLogMessage, ...; | ||
+ | |||
+ | ... | ||
+ | while i < 200 do | ||
+ | LMDLog.WatchInteger('i', i); | ||
+ | ... | ||
+ | </delphi> | ||
+ | |||
+ | To logging flow of application, below methods available: | ||
+ | TLMDLogSession.Enter*, TLMDLogSession.Leave*. Sample: | ||
+ | |||
+ | <delphi> | ||
+ | uses | ||
+ | ..., LMDLogMessage, ...; | ||
+ | |||
+ | ... | ||
+ | function TestFunction: HResult; | ||
+ | begin | ||
+ | LMDLog.EnterMethod | ||
+ | try | ||
+ | ... | ||
+ | finally | ||
+ | LMDLog.SendHResult('Result', Result); | ||
+ | LMDLog.LeaveMethod('NewProcedure'); | ||
+ | end; | ||
+ | end; | ||
+ | ... | ||
+ | </delphi> | ||
+ | |||
+ | |||
+ | To control log storage TLMDLogSession has next methods - | ||
+ | TLMDLogSession.ClearLog, TLMDLogSession.ClearWatch and TLMDLogSession.ClearCallStack |
Revision as of 12:51, 16 July 2007
Main purpose of this tool package is logging and monitoring actions of application. It should be used when you can't run regular debugger (or when it useless) - multi-thread application, system services, applications on client site etc.
In current pre-beta stage it give a basic opportunity to user. To start use LogTools in your application you should add LMDLogMessage.pas unit to uses section of your unit. And then you can use LMDLog instance of TLMDLogSession.
<delphi> uses
..., LMDLogMessage, ...;
...
LMDLog.SendString('Test', 'Hello, World!');
... </delphi>
TLMDLogSession class has methods to send some info into main log - TLMDLogSession.Send*, to watch data in Watch area - TLMDLogSession.Watch* (main different with Send* function that Watch* has just changed value of watched variables, but not add new record)
<delphi> uses
..., LMDLogMessage, ...;
...
while i < 200 do LMDLog.WatchInteger('i', i);
... </delphi>
To logging flow of application, below methods available: TLMDLogSession.Enter*, TLMDLogSession.Leave*. Sample:
<delphi> uses
..., LMDLogMessage, ...;
... function TestFunction: HResult; begin
LMDLog.EnterMethod try ... finally LMDLog.SendHResult('Result', Result); LMDLog.LeaveMethod('NewProcedure'); end;
end; ... </delphi>
To control log storage TLMDLogSession has next methods -
TLMDLogSession.ClearLog, TLMDLogSession.ClearWatch and TLMDLogSession.ClearCallStack