private void SendMessage(LogEntry logEntry) { if (IsValidLogLevel(logEntry.LogLevel.ToString())) { IWebSocketWrapper _ws = null; try { _ws = _webSocketPool.Acquire(Dev2.Common.Config.Auditing.Endpoint); if (!_ws.IsOpen()) { _ws.Connect(); } var logCommand = new AuditCommand { Type = "LogEntryCommand", LogEntry = logEntry }; var msg = _serializer.Serialize(logCommand); _ws.SendMessage(msg); } finally { _webSocketPool.Release(_ws); } } }
public void LogAuditState(Object logEntry) { if (!_ws.IsOpen()) { _ws = _webSocketFactory.Acquire(Config.Auditing.Endpoint); _ws.Connect(); } if (logEntry is Audit auditLog) { var auditCommand = new AuditCommand { Audit = auditLog, Type = "LogEntry" }; string json = JsonConvert.SerializeObject(auditCommand); _ws.SendMessage(json); } }
private void SendMessage(string jsonLogEntry) { IWebSocketWrapper client = null; try { client = _webSocketFactory.Acquire(Config.Auditing.Endpoint); if (!client.IsOpen()) { client = _webSocketFactory.Acquire(Config.Auditing.Endpoint); } client.SendMessage(jsonLogEntry); } catch (Exception ex) { Dev2Logger.Error("LogAuditState", ex.InnerException == null ? ex.Message : ex.InnerException.Message); } finally { _webSocketFactory.Release(client); } }