Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiningRush committed Jan 6, 2018
1 parent 6824be4 commit 5da5ebe
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ServiceAnt.IocInstaller.Autofac/ServiceAntModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ServiceAntModule : Module
/// <summary>
/// Constructor
/// </summary>
/// <param name="handlerAssemblies"> the assemblies which containg handler, thos will be register to container</param>
/// <param name="handlerAssemblies"> the assemblies which containg handler, those will be register to container</param>
public ServiceAntModule(params System.Reflection.Assembly[] handlerAssemblies)
{
_handlerAssemblies = handlerAssemblies;
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceAnt.IocInstaller.Castle/ServiceAntInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ServiceAntInstaller : IWindsorInstaller
/// <summary>
/// Constructor
/// </summary>
/// <param name="handlerAssemblies"> the assemblies which containg handler, thos will be register to container</param>
/// <param name="handlerAssemblies"> the assemblies which containg handler, those will be register to container</param>
public ServiceAntInstaller(params Assembly[] handlerAssemblies)
{
_handlerAssemblies = handlerAssemblies;
Expand Down
29 changes: 28 additions & 1 deletion src/ServiceAnt/IServiceBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,33 @@

namespace ServiceAnt
{
/// <summary>
/// BusMessageLevel
/// </summary>
public enum LogLevel
{
/// <summary>
/// Debug
/// </summary>
DEBUG,
/// <summary>
/// INFO
/// </summary>
INFO,
/// <summary>
/// Error
/// </summary>
ERROR
}

/// <summary>
/// This delegate used to handle bus message
/// </summary>
/// <param name="msgLevel">message level</param>
/// <param name="message">message</param>
/// <param name="ex">if happended exception, it will return it</param>
public delegate void LogBusMessage(LogLevel msgLevel, string message, Exception ex);

/// <summary>
/// It used to publish event or send a request
/// </summary>
Expand All @@ -14,7 +41,7 @@ public interface IServiceBus : IAddSubscription, IAddRequestHandler
/// <summary>
/// Use to log message of bus
/// </summary>
event Action<string, string, Exception> OnLogBusMessage;
event LogBusMessage OnLogBusMessage;

/// <summary>
/// Publish a event
Expand Down
8 changes: 4 additions & 4 deletions src/ServiceAnt/InProcessServiceBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class InProcessServiceBus : IServiceBus
/// <summary>
/// Use to log message of bus
/// </summary>
public event Action<string, string, Exception> OnLogBusMessage;
public event LogBusMessage OnLogBusMessage;

private static Lazy<InProcessServiceBus> _defaultInstance = new Lazy<InProcessServiceBus>();

Expand Down Expand Up @@ -163,7 +163,7 @@ private async Task ProcessEvent(string eventName, string message)
}
catch (Exception ex)
{
LogMessage( "error", "There has raised a error when publishing event.", ex);
LogMessage( LogLevel.ERROR, "There has raised a error when publishing event.", ex);
}
}
}
Expand Down Expand Up @@ -294,7 +294,7 @@ private async Task<T> ProcessRequest<T>(string eventName, string message)
}
catch (Exception ex)
{
LogMessage("error", "There has raised a error when send request.", ex);
LogMessage(LogLevel.ERROR, "There has raised a error when send request.", ex);
}
}

Expand All @@ -303,7 +303,7 @@ private async Task<T> ProcessRequest<T>(string eventName, string message)

#endregion

private void LogMessage(string type, string value, Exception ex)
private void LogMessage(LogLevel type, string value, Exception ex)
{
OnLogBusMessage?.Invoke(type, value, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<PackageReference Include="Castle.Windsor" Version="3.3.0" />
<PackageReference Include="Castle.Windsor" Version="3.4.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Castle.Windsor" Version="4.1.0" />
Expand Down

0 comments on commit 5da5ebe

Please sign in to comment.