Example #1
0
        public override List <LogEntry> GetLogEntries(DateTime from, DateTime to)
        {
            Args.ThrowIfNull(Logger, "Logger");
            Data.EventCollection data    = Data.Event.Where(c => c.Time > from && c.Time < to, DaoLogger.Database);
            List <LogEntry>      results = new List <LogEntry>();

            foreach (Data.Event eventData in data)
            {
                LogEntry entry = new LogEntry();
                entry.Source           = eventData.SourceNameOfSourceNameId.Value;
                entry.Category         = eventData.CategoryNameOfCategoryNameId.Value;
                entry.EventID          = Convert.ToInt32(eventData.Id);
                entry.User             = eventData.UserNameOfUserNameId.Value;
                entry.Time             = eventData.Time.Value;
                entry.MessageSignature = eventData.SignatureOfSignatureId.Value;
                List <Data.Param> args = new List <Data.Param>(eventData.Params);
                args.Sort((one, two) => one.Position.Value.CompareTo(two.Position.Value));
                entry.MessageVariableValues = args.Select(p => p.Value).ToArray();
                entry.Message  = entry.MessageSignature._Format(args.ToArray());
                entry.Computer = eventData.ComputerNameOfComputerNameId.Value;
                entry.Severity = (Severity)eventData.Severity.Value;
                results.Add(entry);
            }

            return(results);
        }
Example #2
0
        /// <summary>
        /// This method is intended to respond to client side Qi queries.
        /// Use of this method from .Net should be avoided in favor of
        /// one of the methods that take a delegate of type
        /// WhereDelegate&lt;EventColumns&gt;.
        /// </summary>
        /// <param name="where"></param>
        /// <param name="database"></param>
        public static EventCollection Where(QiQuery where, Database database = null)
        {
            var results = new EventCollection(database, Select <EventColumns> .From <Event>().Where(where, database));

            return(results);
        }