Class I3LogEventClient
Implements an I3 V3 Log Event Client. This class allows an application to send log events to a log event server.
Inherited Members
Namespace: I3V3.LoggingHelpers
Assembly: Ng911Lib.dll
Syntax
public class I3LogEventClient
Constructors
| Edit this page View SourceI3LogEventClient(string, string, X509Certificate2, bool)
Constructs a new I3LogEventClient object. After creating a new object, hook the events and then call the Start() method before sending log events.
Declaration
public I3LogEventClient(string strServerUrl, string strLoggerName, X509Certificate2 clientCertificate, bool enabled = true)
Parameters
Type | Name | Description |
---|---|---|
string | strServerUrl | HTTP or HTTPS URL of the log event server. For example: https://ESInetLogger.com. The client will post log events to https://ESInetLogger.com/LogEvents and get version information from https://ESInetLogger.com/Versions |
string | strLoggerName | Name of the logging server. For example: Logger1 |
X509Certificate2 | clientCertificate | X.509 certificate to use if mutual authentication is used. May be null if mutual authentication is not required. |
bool | enabled | Sets the initial enabled state of the client. |
Properties
| Edit this page View SourceEnable
If true then this client will send log events to the log event server and periodically poll the log event server. If false, then this client will run but it will not attempt to communicate with the log event server.
Declaration
public bool Enable { get; set; }
Property Value
Type | Description |
---|---|
bool |
Responding
Returns true if the log event server is currently responding to requests or false if it is not.
Declaration
public bool Responding { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceGetVersionsArrayAsync()
Gets the logging schema versions that the log event server supports. This method must be called before Start() is called and the caller must wait for the response.
Declaration
public Task<VersionsArrayType> GetVersionsArrayAsync()
Returns
Type | Description |
---|---|
Task<VersionsArrayType> | Returns a VersionsArrayType object if successful. Returns null if the request to the server times out or if some other error occurred. |
SendLogEvent(LogEvent)
Sends a log event to the logging server if currently connected.
Declaration
public void SendLogEvent(LogEvent logEvent)
Parameters
Type | Name | Description |
---|---|---|
LogEvent | logEvent | I3V3 log event to send. |
Shutdown()
Call this method to shut down the client thread. This method should be called so that all resources are cleanly released.
Declaration
public void Shutdown()
Start()
Starts the log event client. The client is ready to send log events after this method is called.
Declaration
public void Start()
Events
| Edit this page View SourceLoggingServerError
This event is fired if an exception occurred when sending a log event to the logging server or if the the logging server responded with a a status code other than 200 or 201.
Declaration
public event I3LoggingErrorDelegate LoggingServerError
Event Type
Type | Description |
---|---|
I3LoggingErrorDelegate |
LoggingServerStatusChanged
This event is fired when the status of the logging server changed.
Declaration
public event LoggingServerStatusChangedDeletate LoggingServerStatusChanged
Event Type
Type | Description |
---|---|
LoggingServerStatusChangedDeletate |