public List <LogRecord> GetLogsOfSource(LogRecordSource logRecordSource) { switch (logRecordSource) { case LogRecordSource.Gateway: return(gatewayLog); case LogRecordSource.GatewayMessages: return(gatewayMessagesLog); case LogRecordSource.GatewayDecodedMessages: return(gatewayDecodedMessagesLog.Select(log => new LogRecord(LogRecordSource.GatewayDecodedMessages, LogRecordType.Info, log.ToString())).ToList());; case LogRecordSource.DataBase: return(dataBaseLog); case LogRecordSource.NodesEngine: return(nodesEngineLog); case LogRecordSource.Nodes: return(nodesLog); case LogRecordSource.System: return(systemLog); } return(null); }
public LogRecord(LogRecordSource source, LogRecordType type, string message) { Date = DateTime.Now; Source = source; Type = type; Message = message; }
public void ClearLogsOfSource(LogRecordSource logRecordSource) { switch (logRecordSource) { case LogRecordSource.Gateway: lock (gatewayLogLock) gatewayLog.Clear(); break; case LogRecordSource.GatewayMessages: lock (gatewayMessagesLogLock) gatewayMessagesLog.Clear(); break; case LogRecordSource.GatewayDecodedMessages: lock (gatewayDecodedMessagesLogLock) gatewayDecodedMessagesLog.Clear(); break; case LogRecordSource.DataBase: lock (dataBaseLogLock) dataBaseLog.Clear(); break; case LogRecordSource.NodesEngine: lock (nodesEngineLogLock) nodesEngineLog.Clear(); break; case LogRecordSource.Nodes: lock (nodesLogLock) nodesLog.Clear(); break; case LogRecordSource.System: lock (systemLogLock) systemLog.Clear(); break; } }
public List <LogRecord> GetLogs(string logType) { if (logType == "All") { return(SystemController.logs.GetAllLogs()); } if (logType == "Errors") { return(SystemController.logs.GetErrorsLogs()); } LogRecordSource source; bool result = LogRecordSource.TryParse(logType, out source); if (!result) { return(null); } return(SystemController.logs.GetLogsOfSource( (LogRecordSource)Enum.Parse(typeof(LogRecordSource), logType))); }
public List<LogRecord> GetLogsOfSource(LogRecordSource logRecordSource) { switch (logRecordSource) { case LogRecordSource.Gateway: return gatewayLog; case LogRecordSource.GatewayMessages: return gatewayMessagesLog; case LogRecordSource.GatewayDecodedMessages: return gatewayDecodedMessagesLog.Select(log => new LogRecord(LogRecordSource.GatewayDecodedMessages, LogRecordType.Info, log.ToString())).ToList(); ; case LogRecordSource.DataBase: return dataBaseLog; case LogRecordSource.NodesEngine: return nodesEngineLog; case LogRecordSource.Nodes: return nodesLog; case LogRecordSource.System: return systemLog; } return null; }