33using System . Collections . Generic ;
44using System . Threading . Tasks ;
55using Microsoft . AspNetCore . SignalR ;
6- using Microsoft . Extensions . Logging ;
6+ using NLog ;
77
88namespace Stratis . Bitcoin . Features . SignalR
99{
10- // ReSharper disable once ClassNeverInstantiated.Global
1110 public class SignalRMessageArgs
1211 {
1312 public string Target { get ; set ; }
@@ -21,30 +20,27 @@ public string GetValue(string key)
2120
2221 public class EventsHub : Hub
2322 {
24- private readonly IDictionary < string , List < Action < SignalRMessageArgs > > > featureSubscriptions
25- = new ConcurrentDictionary < string , List < Action < SignalRMessageArgs > > > ( StringComparer . OrdinalIgnoreCase ) ;
23+ private readonly IDictionary < string , List < Action < SignalRMessageArgs > > > featureSubscriptions = new ConcurrentDictionary < string , List < Action < SignalRMessageArgs > > > ( StringComparer . OrdinalIgnoreCase ) ;
24+ private readonly ILogger logger ;
2625
27- private readonly ILogger < EventsHub > logger ;
28-
29- public EventsHub ( ILoggerFactory loggerFactory )
26+ public EventsHub ( )
3027 {
31- this . logger = loggerFactory . CreateLogger < EventsHub > ( ) ;
28+ this . logger = LogManager . GetCurrentClassLogger ( ) ;
3229 }
3330
3431 public override Task OnConnectedAsync ( )
3532 {
36- this . logger . LogDebug ( "New client with id {id} connected" , this . Context . ConnectionId ) ;
33+ this . logger . Debug ( "New client with id {id} connected" , this . Context . ConnectionId ) ;
3734 return base . OnConnectedAsync ( ) ;
3835 }
3936
4037 public override Task OnDisconnectedAsync ( Exception exception )
4138 {
42- this . logger . LogDebug ( "Client with id {id} disconnected" , this . Context . ConnectionId ) ;
39+ this . logger . Debug ( "Client with id {id} disconnected" , this . Context . ConnectionId ) ;
4340 return base . OnDisconnectedAsync ( exception ) ;
4441 }
4542
4643 /// <summary>Called using reflection from SignalR</summary>
47- // ReSharper disable once UnusedMember.Global
4844 public void SendMessage ( SignalRMessageArgs message )
4945 {
5046 try
@@ -59,7 +55,7 @@ public void SendMessage(SignalRMessageArgs message)
5955 }
6056 catch ( Exception e )
6157 {
62- this . logger . LogError ( "Error SendMessage" , e ) ;
58+ this . logger . Error ( "Error SendMessage" , e ) ;
6359 }
6460 }
6561
@@ -92,7 +88,7 @@ public async Task SendToClientsAsync(IClientEvent @event)
9288 }
9389 catch ( Exception ex )
9490 {
95- this . logger . LogError ( ex , "Error sending to clients" ) ;
91+ this . logger . Error ( ex , "Error sending to clients" ) ;
9692 }
9793 }
9894 }
0 commit comments