dOPC Client Toolkit
Close
ua.client.TdOPCUAClient.OnLog

Occurs when logging event is fired.

property OnLog: TuaOnLogEvent;
__property TuaOnLogEvent OnLog;

If you want to log the OPC UA requests and responses then this event the right one. 

Very important: If you want to show the log in a GUI you have use TThread.Queue. 

 

Parameter
Description
Sender
The sender (source) of the log message, normally the tdOPCUAClient object.
LogSeverity
The severity of the message. Following values are possible:
TuaLog.Debug = 0;
TuaLog.Info = 1;
TuaLog.Warning = 2;
TuaLog.Error = 3;
TuaLog.Exception= 4;
LogType
The type of the message. Following values are possible:
TuaLog.NilValue = 5;
TuaLog.Request = 6;
TuaLog.RequestAsync = 7;
TuaLog.RequestSecure = 8;
TuaLog.Response = 9;
TuaLog.ResponseAsync = 10;
TuaLog.ResponseSecure= 11;
LogMessage
The log message
Data
Data normally includes the request (TuaRequestObj) or the response (TuaResponseObj),depending on the log type
// simple logging procedure TReadDemo.dOPCUAClient1Log(Sender: TObject; LogSeverity: Integer; LogType: Cardinal; LogMessage: string; Data: TuaObj); begin TThread.Queue(nil,procedure() begin Memo1.Lines.Add(LogMessage + ' '+ TuaLog.ToString(LogType)); end); end; // shows detailed response as JSON message in a memo box procedure TBrowseDemo.AddToLog(LogMessage: string; Data: TuaObj); var Response: TuaResponseObj; begin if (Data <> nil) and (Data is TuaResponseObj) then begin Response := TuaResponseObj(Data); MemoResponse.Lines.Text := Response.ToString; end; end; procedure TBrowseDemo.OPCClientLog(Sender: TObject; LogSeverity: Integer; LogType: Cardinal; LogMessage: string; Data: TuaObj); begin TThread.Queue(nil,procedure() begin AddToLog(LogMessage,Data); end); end;
Kassl GmbH Copyright © 2021. All rights reserved.