Пример #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<LogMessage> Get(SessionLogQuery query= null){
			query = query?? new SessionLogQuery();
			foreach (var message in _log){
				if (!message.Active) continue;
				if (message.Level < query.StartLevel) continue;
				if (!string.IsNullOrWhiteSpace(query.Code) && query.Code != message.Code) continue;
				if (0 != query.StartTimestamp){
					if(message.Timestamp<=query.StartTimestamp)continue;
				}
				if (query.OnlyAccepted || query.OnlyNotAccepted || query.OnlyRequests){
					if(!message.RequireAccept)continue;
					if (query.OnlyAccepted && !message.Accepted) continue;
					if (query.OnlyNotAccepted && message.Accepted) continue;
				}
				yield return message;
			}
		} 
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public IEnumerable <LogMessage> Get(SessionLogQuery query = null)
 {
     query = query ?? new SessionLogQuery();
     foreach (var message in _log)
     {
         if (!message.Active)
         {
             continue;
         }
         if (message.Level < query.StartLevel)
         {
             continue;
         }
         if (!string.IsNullOrWhiteSpace(query.Code) && query.Code != message.Code)
         {
             continue;
         }
         if (0 != query.StartTimestamp)
         {
             if (message.Timestamp <= query.StartTimestamp)
             {
                 continue;
             }
         }
         if (query.OnlyAccepted || query.OnlyNotAccepted || query.OnlyRequests)
         {
             if (!message.RequireAccept)
             {
                 continue;
             }
             if (query.OnlyAccepted && !message.Accepted)
             {
                 continue;
             }
             if (query.OnlyNotAccepted && message.Accepted)
             {
                 continue;
             }
         }
         yield return(message);
     }
 }