Skip to content

Commit

Permalink
change the way of log message
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiningRush committed Dec 13, 2017
1 parent 3740a08 commit d0e06dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/ServiceAnt/InProcessServiceBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using ServiceAnt.Handler.Request;
using ServiceAnt.Handler.Request.Handler;
using ServiceAnt.Handler.Subscription.Handler;
using ServiceAnt.Infrastructure.Log;
using ServiceAnt.Subscription;
using System;
using System.Threading.Tasks;
Expand All @@ -16,13 +15,12 @@ public class InProcessServiceBus : IServiceBus
private ISubscriptionManager _subcriptionManager;
private IRequestHandlerManager _requestHandlerManager;

public ILogger Logger { get; set; }
public event Action<string, string, Exception> OnBusMessagePubishing;

public InProcessServiceBus()
{
_subcriptionManager = new InMemorySubscriptionsManager();
_requestHandlerManager = new InMemoryRequestHandlerManager();
//Logger = NullLogger.Instance;
}

public InProcessServiceBus(ISubscriptionManager subcriptionManager)
Expand Down Expand Up @@ -106,7 +104,7 @@ private async Task ProcessEvent(string eventName, string message)
}
catch (Exception ex)
{
Logger.Debug("触发事件总线时发生错误。", ex);
LogMessage( "error", "There has raised a error when publishing event.", ex);
}
}
}
Expand Down Expand Up @@ -191,12 +189,17 @@ private async Task<T> ProcessRequest<T>(string eventName, string message)
}
catch (Exception ex)
{
Logger.Debug("发送请求事件时发生错误。", ex);
LogMessage( "error", "There has raised a error when send request.", ex);
}
}

return (T)requestContext.Response;
}
#endregion

private void LogMessage(string type, string value, Exception ex)
{
OnBusMessagePubishing(type, value, ex);
}
}
}
1 change: 0 additions & 1 deletion src/ServiceAnt/ServiceAnt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
<Compile Include="Handler\SingletonHandlerFactory.cs" />
<Compile Include="Handler\TransportTray.cs" />
<Compile Include="Infrastructure\Dependency\IIocResolver.cs" />
<Compile Include="Infrastructure\Log\ILogger.cs" />
<Compile Include="InProcessServiceBus.cs" />
<Compile Include="IServiceBus.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down

0 comments on commit d0e06dd

Please sign in to comment.