{***********************}
{ }
{ CodeMachine }
{ }
{ 版權所有 (C) 2004 nil }
{ }
{ 2004-6-10 }
{ }
{************************}
{
通常將TTracer的實例存放於application級的Session中,在使用時,
創建一個ITraceInfo,調用TTracer.Write(ITraceInfo)即可,
}
unit com.sunset.app.tracer;
interface
uses StrUtils,classes,SysUtils;
type
//==========================
// 接口聲明
//==========================
//跟蹤信息的接口
ITraceInfo = interface
function ToString: string;
end;
//輸出目標的接口
IOutput = interface
procedure Write(const aInfo: ITraceInfo); //寫入跟蹤信息
end;
//==========================
// 跟蹤信息類 ,實現 ITraceInfo
//==========================
//string形式的跟蹤記錄
TStringTI = class(TInterfacedObject, ITraceInfo)
private
FData: string;
public
constructor Create(data: string);
function ToString: string;
end;
//==========================
// 跟蹤信息輸出類,實現 IOutput
//==========================
TFileLog = class(TInterfacedObject, IOutput)
private
FLogFile: string;
public
constructor Create(const FileName: string);
procedure Write(const aInfo: ITraceInfo); //寫入跟蹤信息
end;
TProcStr = procedure(const value:string) of Object;
TDatabaseLog = class(TInterfacedObject, IOutput)
private
FWriteProc :TProcStr;