Exemplo n.º 1
0
 public static void NormalLog(LogItem aLog)
 {
     lock (locker)
     {
         normalQueue.Enqueue(aLog);
         while (normalQueue.Count > 1000)
         {
             LogItem log = null;
             normalQueue.TryDequeue(out log);
         }
         ConcurrentQueue<LogItem> tokenDictQue = null;
         if (tokenDict.TryGetValue(aLog.token, out tokenDictQue))
         {
             tokenDictQue.Enqueue(aLog);
         }
         else
         {
             tokenDict.TryAdd(aLog.token, new ConcurrentQueue<LogItem>(new LogItem[] { aLog }));
             tokenQueue.Enqueue(aLog.token);
             while(tokenQueue.Count > 1000)
             {
                 string token = null;
                 tokenQueue.TryDequeue(out token);
                 tokenDict.TryRemove(token, out tokenDictQue);
             }
         }
         if (onNewNormalLog != null)
             onNewNormalLog(null, new NewLogEventArgs(aLog));
     }
 }
Exemplo n.º 2
0
 private static void ProcessLog(LogItem aLog)
 {
     switch(aLog.token)
     {
         case "BEAT":
             LogCore.BeatLog(aLog);
             break;
         default:
             LogCore.NormalLog(aLog);
             break;
     }
 }
Exemplo n.º 3
0
 public static void BeatLog(LogItem aLog)
 {
     lock(locker)
     {
         beatQueue.Enqueue(aLog);
         while(beatQueue.Count > 1000)
         {
             LogItem log = null;
             beatQueue.TryDequeue(out log);
         }
         if (onNewBeatLog != null)
             onNewBeatLog(null, new NewLogEventArgs(aLog));
     }
 }
Exemplo n.º 4
0
 public NewLogEventArgs(LogItem aLog)
 {
     Log = aLog;
 }