Call log entry structure. AOP logger has a collection of these objects that is populated by Proxy, Aspects, and sometimes by callers and intercepted methods.
        /// <summary>
        ///     Whittles down log item collection according with values of entryTypeFilter, keys, and writeAllEntriesIfKeyFound.
        /// </summary>
        /// <param name="entries"></param>
        /// <returns></returns>
        protected virtual IEnumerable <CallLogEntry> FilterLogEntries(List <CallLogEntry> entries)
        {
            IEnumerable <CallLogEntry> filtered;

            if (this.writeAllEntriesIfKeyFound && this.keys.Length != 0)
            {
                bool keyFound = entries.Any(entry => this.keys.Contains(entry.Key));
                if (!keyFound)
                {
                    filtered = new CallLogEntry[0];
                }
                else
                {
                    filtered = entries.Where(entry => this.entryTypeFilter.IsAnyFlagOn(entry.What));
                }
            }
            else
            {
                filtered = from entry in entries
                           where this.entryTypeFilter.IsAnyFlagOn(entry.What) && (this.keys.Length == 0 || this.keys.Contains(entry.Key))
                           select entry;
            }

            return(filtered);
        }
Example #2
0
        private void AddEntryIntrenal(LogEntryOriginator who, Type optionalAspectType, EntryType entryType, string category, string format, params object[] args)
        {
            var entry = new CallLogEntry
            {
                Who                = who,
                Key                = category,
                What               = entryType,
                Message            = format.SmartFormat(args),
                OptionalAspectType = optionalAspectType == null ? null : optionalAspectType.FormatCSharp(true),
            };

            this.callLog.Add(entry);
        }
        /// <summary>
        ///     Whittles down log item collection according with values of entryTypeFilter, keys, and writeAllEntriesIfKeyFound.
        /// </summary>
        /// <param name="entries"></param>
        /// <returns></returns>
        protected virtual IEnumerable<CallLogEntry> FilterLogEntries(List<CallLogEntry> entries)
        {
            IEnumerable<CallLogEntry> filtered;

            if(this.writeAllEntriesIfKeyFound && this.keys.Length != 0)
            {
                bool keyFound = entries.Any(entry => this.keys.Contains(entry.Key));
                if(!keyFound)
                    filtered = new CallLogEntry[0];
                else
                    filtered = entries.Where(entry => this.entryTypeFilter.IsAnyFlagOn(entry.What));
            } else
            {
                filtered = from entry in entries
                    where this.entryTypeFilter.IsAnyFlagOn(entry.What) && (this.keys.Length == 0 || this.keys.Contains(entry.Key))
                    select entry;
            }

            return filtered;
        }
Example #4
0
        private void AddEntryIntrenal(LogEntryOriginator who, Type optionalAspectType, EntryType entryType, string category, string format, params object[] args)
        {
            var entry = new CallLogEntry
            {
                Who = who,
                Key = category,
                What = entryType,
                Message = format.SmartFormat(args),
                OptionalAspectType = optionalAspectType == null ? null : optionalAspectType.FormatCSharp(true),
            };

            this.callLog.Add(entry);
        }