private void LogPreCall(IMethodInvocation input) { if (this.logBeforeCall) { TraceLogEntry logEntry = this.GetLogEntry(input); logEntry.Message = this.beforeMessage; logEntry.Title = string.Format(" {0}.{1}", input.MethodBase.ReflectedType.FullName, input.MethodBase.Name); this.logWriter.TryWrite(logEntry.ToString()); } }
private void LogPostCall(IMethodInvocation input, Stopwatch sw, IMethodReturn result) { if (this.logAfterCall) { TraceLogEntry logEntry = this.GetLogEntry(input); logEntry.Message = this.afterMessage; logEntry.ReturnValue = null; if (result.ReturnValue != null && this.includeParameters) { logEntry.ReturnValue = result.ReturnValue.ToString(); } if (result.Exception != null) { logEntry.Exception = result.Exception.ToString(); } if (this.includeCallTime) { logEntry.CallTime = new TimeSpan?(sw.Elapsed); } logEntry.Title = string.Format(" {0}.{1}", input.MethodBase.ReflectedType.FullName, input.MethodBase.Name); this.logWriter.TryWrite(logEntry.ToString()); } }