示例#1
0
        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);
        }
示例#2
0
 public LogRecord(LogRecordSource source, LogRecordType type, string message)
 {
     Date = DateTime.Now;
     Source = source;
     Type = type;
     Message = message;
 }
示例#3
0
 public LogRecord(LogRecordSource source, LogRecordType type, string message)
 {
     Date    = DateTime.Now;
     Source  = source;
     Type    = type;
     Message = message;
 }
示例#4
0
        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;
            }
        }
示例#5
0
        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)));
        }
示例#6
0
 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;
     }
 }
示例#7
0
 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;
 }