-
Notifications
You must be signed in to change notification settings - Fork 10
GetStartedWithJachLog
To start, download and store the source code of the library in a local folder.
You can use Git/Github and SubVersion clients to maintain the link to the online source, so you can get updates of the library as soon as they are published.
This guide will use the c:\source\lib\jachLog
as the root path for the library, you can use any path available for your system.
In a Delphi project, configure the search path in the project options, so the compilers can find the library, adding the .\src
folder to it, for example:
If you plan to use the library in different projects, you can also configure the IDE to allow the compilers find the library for all projects you open in your machine. In your IDE go to Tools/Options/Library and add ;c:\source\lib\jachLog\src
at the end of the Library Path field for the desired platforms (32-bit Windows and 64-bit Windows are supported in v2.0).
The simple way to start logging is to include the ujachLogAuto
unit in the uses clause of your project or any of your project units.
If you're an advanced user, you may want to create and configure all by hand.
Add the ujachLogAuto
and ujachLogMgr
to the uses clause of any unit where you want to write a Log message.
Invoke the any of the Log methods of the log object to add entries to the Log.
Take a look at the following example:
uses
ujachLogMgr, ujachLogAuto;
{$R *.dfm}
procedure TmyForm.ProcessData(InputFileName: string);
var
I: Integer;
begin
jachLog.LogInfo('Data processing start, FileName: %s', [InputFileName]);
try
jachLog.LogInfo('Opening file...');
OpenDataFile(InputFileName);
jachLog.LogInfo('Processing %d records on file...', [FDataFile.RecordCount]);
for I := 0 to FDataFile.RecordCount - 1 do
ProcessDataRecord(I);
jachLog.LogInfo('Closing file...');
CloseDataFile();
jachLog.LogInfo('Sending notifications...');
SendNotifications;
jachLog.LogInfo('Data processing finished succesfully');
except
on E:Exception do
begin
jachLog.LogError('Data processing finished with Error', E);
raise;
end;
end;
end;
Explore the available demo applications as they show how to integrate the library, how it works and how to code to take advantage of it's characteristics.
jump to: get started — multiple log destinations — units and classes — wiki home — blog (English) — blog (Spanish) — library home