'Declaration
Public Event LogEntry As LogEntryEventHandler
'Usage
Dim instance As EasyUAClientCore Dim handler As LogEntryEventHandler AddHandler instance.LogEntry, handler
public event LogEntryEventHandler LogEntry
public: event LogEntryEventHandler^ LogEntry
Event Data
The event handler receives an argument of type LogEntryEventArgs containing data related to this event. The following LogEntryEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Category | The application-specific subcategory associated with the message. |
DefaultTimestamp | Default value of the Timestamp property. |
EntryType | Entry type. One of the LogEntryType values. |
EventId | The application-specific identifier for the event. |
Message | The message text. |
RawData | An array of bytes that holds the binary data associated with the entry. |
Source | The name of the event source. |
Timestamp | Date and time of the log entry message. In UTC. |
TimestampDouble | Date and time of the log entry message. In UTC, as double-precision floating-point number that contains an OLE Automation date. |
TimestampLocal | Date and time of the log entry message. In local time. |
TimestampLocalDouble | Date and time of the log entry message. In local time, as double-precision floating-point number that contains an OLE Automation date. |
Example
// This example demonstrates the loggable entries originating in the OPC-UA client engine and the EasyUAClient component. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System; using OpcLabs.BaseLib.Instrumentation; using OpcLabs.EasyOpc.UA; using OpcLabs.EasyOpc.UA.OperationModel; namespace UADocExamples._EasyUAClient { class LogEntry { public static void Main1() { UAEndpointDescriptor endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"; // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) // or "https://opcua.demo-this.com:51212/UA/SampleServer/" // Hook static events EasyUAClient.LogEntry += EasyUAClientOnLogEntry; try { // Do something - invoke an OPC read, to trigger some loggable entries. var client = new EasyUAClient(); try { client.ReadValue(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853"); } catch (UAException uaException) { Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message); return; } Console.WriteLine("Processing log entry events for 1 minute..."); System.Threading.Thread.Sleep(60 * 1000); Console.WriteLine("Finished."); } finally { // Unhook static events EasyUAClient.LogEntry -= EasyUAClientOnLogEntry; } } // Event handler for the LogEntry event. It simply prints out the event. private static void EasyUAClientOnLogEntry(object sender, LogEntryEventArgs logEntryEventArgs) { Console.WriteLine(logEntryEventArgs); } } }
' This example demonstrates the loggable entries originating in the OPC-UA client engine and the EasyUAClient component. ' ' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . ' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET . ' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own ' a commercial license in order to use Online Forums, and we reply to every post. Imports OpcLabs.BaseLib.Instrumentation Imports OpcLabs.EasyOpc.UA Imports OpcLabs.EasyOpc.UA.OperationModel Namespace _EasyUAClient Friend Class LogEntry Public Shared Sub Main1() Dim endpointDescriptor As UAEndpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) ' or "https://opcua.demo-this.com:51212/UA/SampleServer/" ' Hook static events AddHandler EasyUAClient.LogEntry, AddressOf EasyUAClientOnLogEntry Try ' Do something - invoke an OPC read, to trigger some loggable entries. Dim client = New EasyUAClient() Try client.ReadValue(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853") Catch uaException As UAException Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message) Exit Sub End Try Console.WriteLine("Processing log entry events for 1 minute...") Threading.Thread.Sleep(60 * 1000) Console.WriteLine("Finished.") Finally ' Unhook static events RemoveHandler EasyUAClient.LogEntry, AddressOf EasyUAClientOnLogEntry End Try End Sub ' Event handler for the LogEntry event. It simply prints out the event. Private Shared Sub EasyUAClientOnLogEntry(ByVal sender As Object, ByVal logEntryEventArgs As LogEntryEventArgs) Console.WriteLine(logEntryEventArgs) End Sub End Class End Namespace
# This example demonstrates the loggable entries originating in the OPC-UA client engine and the EasyUAClient component. # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python . # Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own # a commercial license in order to use Online Forums, and we reply to every post. # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc import time # Import .NET namespaces. from OpcLabs.EasyOpc.UA import * from OpcLabs.EasyOpc.UA.OperationModel import * # Event handler for the LogEntry event. It simply prints out the event. def onLogEntry(sender, logEntryEventArgs): print(logEntryEventArgs) endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer') # or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported) # or 'https://opcua.demo-this.com:51212/UA/SampleServer/' # Hook static events. EasyUAClient.LogEntry += onLogEntry # Instantiate the client object. client = EasyUAClient() # Do something - invoke an OPC read, to trigger some loggable entries. try: value = IEasyUAClientExtension.ReadValue(client, endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853')) except UAException as uaException: print('*** Failure: ' + uaException.GetBaseException().Message) exit() print('Processing log entry events for 1 minute...') time.sleep(60) print() print('Finished.')
Requirements