Example #1
0
        public void LogAuditState(Object logEntry)
        {
            try
            {
                Enum.TryParse(Config.Server.ExecutionLogLevel, out LogLevel executionLogLevel);
                if (logEntry is Audit auditLog && IsValidLogLevel(executionLogLevel, auditLog.LogLevel.ToString()))
                {
                    _ws = _webSocketFactory.Acquire(Config.Auditing.Endpoint);
                    _ws.Connect();

                    var auditCommand = new AuditCommand
                    {
                        Audit = auditLog,
                        Type  = "LogEntry"
                    };
                    string json = JsonConvert.SerializeObject(auditCommand);
                    _ws.SendMessage(json);
                }
            }
            catch (Exception e)
            {
                Dev2Logger.Error("LogAuditState", e.Message);
            }
            finally
            {
                if (_ws != null)
                {
                    _webSocketFactory.Release(_ws);
                    _ws = null;
                }
            }
        }
        public void LogAuditState(Object logEntry)
        {
            Enum.TryParse(Config.Server.ExecutionLogLevel, out LogLevel executionLogLevel);

            if (logEntry is Audit auditLog && IsValidLogLevel(executionLogLevel, auditLog.LogLevel.ToString()))
            {
                var auditCommand = new AuditCommand
                {
                    Audit = auditLog,
                    Type  = "LogEntry"
                };
                var jsonLogEntry = JsonConvert.SerializeObject(auditCommand);
                SendMessage(jsonLogEntry);
            }
        }
Example #3
0
        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);
            }
        }