public IList<OrderedOutput> HandleMethodExit(MethodExit logEntry, int lineNo, ILogFilters filters, Func<DateTime, string> lineBuilder, bool displayEnabled) { if (!displayEnabled) { // method is not actually displayed, we are tracking the nesting level for other items displayed such as logs, exceptions, etc _currentNestedLevel--; return null; } if ((_lastMethodEntry == null) || (_lastMethodEntry.Count <= 0)) throw new InvalidOperationException(String.Format("No related Method Entry log has been set for '{0}' at line {1:0000} - there could be a problem with the yalf logs." , logEntry.MethodName, lineNo)); if (_lastMethodEntry.Peek().MethodName != logEntry.MethodName) throw new InvalidOperationException(String.Format("The method exit log '{1}' has a different name than the current method entry log '{0}' at line {2:0000} - there could be a problem with the yalf logs." , _lastMethodEntry.Peek().MethodName, logEntry.MethodName, lineNo)); var currentMethodEntry = _lastMethodEntry.Pop(); _currentNestedLevel--; int indexOfEntryToUpdate = FindLastIndexOf(currentMethodEntry); if (indexOfEntryToUpdate < 0) throw new InvalidOperationException(String.Format("Could not find the method [{0}] in the current ordered buffer. This probably means there is an error in the processing logic, or the yalf file is corrupt.", currentMethodEntry.MethodName)); var currentItem = _orderedBuffer[indexOfEntryToUpdate]; _orderedBuffer[indexOfEntryToUpdate] = new LogEntryTracker(currentItem.Level, currentItem.RelatedEntry, lineBuilder(currentMethodEntry.Time)); if (_lastMethodEntry.Count > 0) return null; _currentNestedLevel = 0; return this.PrepareOutputBuffer(); }
public IList <OrderedOutput> HandleMethodExit(MethodExit logEntry, int lineNo, ILogFilters filters, Func <DateTime, string> lineBuilder, bool displayEnabled) { if (!displayEnabled) { // method is not actually displayed, we are tracking the nesting level for other items displayed such as logs, exceptions, etc _currentNestedLevel--; return(null); } if ((_lastMethodEntry == null) || (_lastMethodEntry.Count <= 0)) { throw new InvalidOperationException(String.Format("No related Method Entry log has been set for '{0}' at line {1:0000} - there could be a problem with the yalf logs." , logEntry.MethodName, lineNo)); } if (_lastMethodEntry.Peek().MethodName != logEntry.MethodName) { throw new InvalidOperationException(String.Format("The method exit log '{1}' has a different name than the current method entry log '{0}' at line {2:0000} - there could be a problem with the yalf logs." , _lastMethodEntry.Peek().MethodName, logEntry.MethodName, lineNo)); } var currentMethodEntry = _lastMethodEntry.Pop(); _currentNestedLevel--; int indexOfEntryToUpdate = FindLastIndexOf(currentMethodEntry); if (indexOfEntryToUpdate < 0) { throw new InvalidOperationException(String.Format("Could not find the method [{0}] in the current ordered buffer. This probably means there is an error in the processing logic, or the yalf file is corrupt.", currentMethodEntry.MethodName)); } var currentItem = _orderedBuffer[indexOfEntryToUpdate]; _orderedBuffer[indexOfEntryToUpdate] = new LogEntryTracker(currentItem.Level, currentItem.RelatedEntry, lineBuilder(currentMethodEntry.Time)); if (_lastMethodEntry.Count > 0) { return(null); } _currentNestedLevel = 0; return(this.PrepareOutputBuffer()); }