2009/07/08

TIdSysLog Class - SendMsg篇(二)

這次再介紹一下IdSysLog SendMessage的內容
基本上,如果捨SendMsg而就Send的話
那麼接收端就會收到單純的Message,TimeStamp就不會追加在Message前面。

而如果要用SendMessage而又不想加TimeStamp,呃…目前我還沒找到方法…如果我有找到的話再放上來吧



TIdSysLog.SendMessage
Sends a message to the loggin daemon.

procedure SendMessage(const AMsg: TIdSysLogMessage; const AAutoTimeStamp: Boolean = true); overload;
procedure SendMessage(const AMsg: String; const AFacility: TidSyslogFacility; const ASeverity: TIdSyslogSeverity); overload;
procedure SendMessage(const AProcess: String; const AText: String; const AFacility: TidSyslogFacility; const ASeverity: TIdSyslogSeverity; const AUsePID: Boolean = False; const APID: Integer = -1); overload;

Parameters

const AMsg: TIdSysLogMessage

Syslog message instance or string.
實體Syslog message 或是 某一字串


const AAutoTimeStamp: Boolean = true

Add time stamp to the message.
增加time stamp到欲輸出的訊息

const AFacility: TidSyslogFacility

The facility for the logged message.
發送訊息的場所

const ASeverity: TIdSyslogSeverity

The severity of the logged message.
發送訊息的重要性

const AProcess: String

The process name.
發送訊息的程序名

const AText: String

Descriptive text for the syslog entry.
可讓syslog發送的描述性文字

const AUsePID: Boolean = False

Use a process ID.
是否使用程序ID (Handle),預設為「否」

const APID: Integer = -1

Process ID for the syslog entry.
可讓syslog發送的程序ID

後面的說明…有點煩雜
主要是在說明SendMessage重載了TIdSyslog後做了哪些的加強及擴充,有興趣的可以再自己翻一下底下的內容。

Description
SendMessage is an overloaded procedure in TIdSysLog used to form and transmit a message destined for the logging daemon.
One variant of SendMessage sends the existing TIdSyslogMessage instance identified in AMsg to the logging daemon. AAutoTimeStamp indicates if the current date and time should be applied to the TIdSyslogMessage.Timestamp property prior to transmission. This variant calls Send using the encode value for the message.

Other variants of SendMessage construct a new TIdSyslogMessage instance and populate it's values using the arguments specified for the procedure. Each of these overloaded procedure calls the SendMessage variant that uses the existing TIdSyslogMessage instance.

沒有留言:

張貼留言