コード例 #1
0
ファイル: LogBehavior.cs プロジェクト: modulexcite/NLogEx
 /// <summary>
 /// Post-request handler
 /// </summary>
 /// <param name="operation">
 /// Correlation object returned from OnRequestBegin
 /// </param>
 /// <param name="reply">
 /// The optional reply message for the request
 /// </param>
 private void OnRequestEnd(Operation operation, ref Message reply)
 {
     operation.Stop();
     // trace the completion of the WCF operation
     this.Log.TraceEx(
        operation,
        "{0}.{1}",
        this.Log.SourceType.FullName,
        operation.Name
     );
     // if a fault occurred, log the fault error
     if (reply != null && reply.IsFault)
     {
        using (MessageBuffer buffer = reply.CreateBufferedCopy(Int32.MaxValue))
        {
       using (Message fault = buffer.CreateMessage())
          this.Log.ErrorEx(
             operation,
             new FaultException(
                MessageFault.CreateFault(fault, Int32.MaxValue)
             )
          );
       reply = buffer.CreateMessage();
        }
     }
 }