Skip to content

Commit

Permalink
Change LogInformation messages to LogDebug
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvister committed Feb 6, 2018
1 parent ca3f5cb commit 5eb7f32
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Binance/WebSocket/AggregateTradeWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual void Subscribe(string symbol, Action<AggregateTradeEventArgs> cal

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(AggregateTradeWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(AggregateTradeWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

SubscribeStream(GetStreamName(symbol), callback);
}
Expand All @@ -58,7 +58,7 @@ public virtual void Unsubscribe(string symbol, Action<AggregateTradeEventArgs> c

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(AggregateTradeWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(AggregateTradeWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

UnsubscribeStream(GetStreamName(symbol), callback);
}
Expand Down
12 changes: 6 additions & 6 deletions src/Binance/WebSocket/BinanceWebSocketStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ public void Subscribe(string stream, Action<WebSocketStreamEventArgs> callback)
throw new InvalidOperationException($"{nameof(BinanceWebSocketStream)}.{nameof(Subscribe)}: Subscribing (a stream) must be done when not streaming.");
}

_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(Subscribe)}: Adding stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_logger?.LogDebug($"{nameof(BinanceWebSocketStream)}.{nameof(Subscribe)}: Adding stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_subscribers[stream] = new List<Action<WebSocketStreamEventArgs>>();
}

// ReSharper disable once InvertIf
if (!_subscribers[stream].Contains(callback))
{
_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(Subscribe)}: Adding callback for stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_logger?.LogDebug($"{nameof(BinanceWebSocketStream)}.{nameof(Subscribe)}: Adding callback for stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_subscribers[stream].Add(callback);
}
//}
Expand All @@ -155,7 +155,7 @@ public void Unsubscribe(string stream, Action<WebSocketStreamEventArgs> callback

if (_subscribers[stream].Contains(callback))
{
_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(Unsubscribe)}: Removing callback for stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_logger?.LogDebug($"{nameof(BinanceWebSocketStream)}.{nameof(Unsubscribe)}: Removing callback for stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_subscribers[stream].Remove(callback);
}

Expand All @@ -169,7 +169,7 @@ public void Unsubscribe(string stream, Action<WebSocketStreamEventArgs> callback
throw new InvalidOperationException($"{nameof(BinanceWebSocketStream)}.{nameof(Unsubscribe)}: Unsubscribing (a stream) must be done when not streaming.");
}

_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(Unsubscribe)}: Removing stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_logger?.LogDebug($"{nameof(BinanceWebSocketStream)}.{nameof(Unsubscribe)}: Removing stream: \"{stream}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_subscribers.Remove(stream);
}
//}
Expand Down Expand Up @@ -302,7 +302,7 @@ public async Task StreamAsync(CancellationToken token)

Client.Message += OnClientMessage;

_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(StreamAsync)}: \"{uri.AbsoluteUri}\" [thread: {Thread.CurrentThread.ManagedThreadId}]");
_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(StreamAsync)}: \"{uri.AbsoluteUri}\"");

await Client.StreamAsync(uri, token)
.ConfigureAwait(false);
Expand All @@ -323,7 +323,7 @@ await Client.StreamAsync(uri, token)
_bufferBlock?.Complete();
_actionBlock?.Complete();

_logger?.LogInformation($"{nameof(BinanceWebSocketStream)}.{nameof(StreamAsync)}: Task complete. [thread: {Thread.CurrentThread.ManagedThreadId}]");
_logger?.LogDebug($"{nameof(BinanceWebSocketStream)}.{nameof(StreamAsync)}: Task complete. [thread: {Thread.CurrentThread.ManagedThreadId}]");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Binance/WebSocket/CandlestickWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual void Subscribe(string symbol, CandlestickInterval interval, Actio

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(CandlestickWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" \"{interval.AsString()}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(CandlestickWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" \"{interval.AsString()}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

SubscribeStream(GetStreamName(symbol, interval), callback);
}
Expand All @@ -58,7 +58,7 @@ public virtual void Unsubscribe(string symbol, CandlestickInterval interval, Act

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(CandlestickWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" \"{interval.AsString()}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(CandlestickWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" \"{interval.AsString()}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

UnsubscribeStream(GetStreamName(symbol, interval), callback);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Binance/WebSocket/DefaultWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, Can
}

IsStreaming = false;
Logger?.LogInformation($"{nameof(DefaultWebSocketClient)}.{nameof(StreamAsync)}: Task complete. [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(DefaultWebSocketClient)}.{nameof(StreamAsync)}: Task complete. [thread: {Thread.CurrentThread.ManagedThreadId}]");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Binance/WebSocket/DepthWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual void Subscribe(string symbol, int limit, Action<DepthUpdateEventA

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(DepthWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" \"{limit}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(DepthWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" \"{limit}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

SubscribeStream(GetStreamName(symbol, limit), callback);
}
Expand All @@ -58,7 +58,7 @@ public virtual void Unsubscribe(string symbol, int limit, Action<DepthUpdateEven

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(DepthWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" \"{limit}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(DepthWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" \"{limit}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

UnsubscribeStream(GetStreamName(symbol, limit), callback);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Binance/WebSocket/SymbolStatisticsWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public SymbolStatisticsWebSocketClient(IWebSocketStream webSocket, ILogger<Symbo

public virtual void Subscribe(Action<SymbolStatisticsEventArgs> callback)
{
Logger?.LogInformation($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Subscribe)}: \"[All Symbols]\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Subscribe)}: \"[All Symbols]\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

SubscribeStream(GetStreamName(null), callback);
}
Expand All @@ -55,14 +55,14 @@ public virtual void Subscribe(string symbol, Action<SymbolStatisticsEventArgs> c

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

SubscribeStream(GetStreamName(symbol), callback);
}

public virtual void Unsubscribe(Action<SymbolStatisticsEventArgs> callback)
{
Logger?.LogInformation($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Unsubscribe)}: \"[All Symbols]\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Unsubscribe)}: \"[All Symbols]\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

UnsubscribeStream(GetStreamName(null), callback);
}
Expand All @@ -73,7 +73,7 @@ public virtual void Unsubscribe(string symbol, Action<SymbolStatisticsEventArgs>

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(SymbolStatisticsWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

UnsubscribeStream(GetStreamName(symbol), callback);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Binance/WebSocket/TradeWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual void Subscribe(string symbol, Action<TradeEventArgs> callback)

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(TradeWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(TradeWebSocketClient)}.{nameof(Subscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

SubscribeStream(GetStreamName(symbol), callback);
}
Expand All @@ -58,7 +58,7 @@ public virtual void Unsubscribe(string symbol, Action<TradeEventArgs> callback)

symbol = symbol.FormatSymbol();

Logger?.LogInformation($"{nameof(TradeWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(TradeWebSocketClient)}.{nameof(Unsubscribe)}: \"{symbol}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

UnsubscribeStream(GetStreamName(symbol), callback);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Binance/WebSocket/UserData/UserDataWebSocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public virtual void Subscribe(string listenKey, IBinanceApiUser user, Action<Use
Throw.IfNullOrWhiteSpace(listenKey, nameof(listenKey));
Throw.IfNull(user, nameof(user));

Logger?.LogInformation($"{nameof(UserDataWebSocketClient)}.{nameof(Subscribe)}: \"{listenKey}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(UserDataWebSocketClient)}.{nameof(Subscribe)}: \"{listenKey}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

// Subscribe callback (if provided) to listen key.
SubscribeStream(listenKey, callback);
Expand All @@ -72,7 +72,7 @@ public virtual void Unsubscribe(string listenKey, Action<UserDataEventArgs> call
{
Throw.IfNullOrWhiteSpace(listenKey, nameof(listenKey));

Logger?.LogInformation($"{nameof(UserDataWebSocketClient)}.{nameof(Unsubscribe)}: \"{listenKey}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");
Logger?.LogDebug($"{nameof(UserDataWebSocketClient)}.{nameof(Unsubscribe)}: \"{listenKey}\" (callback: {(callback == null ? "no" : "yes")}). [thread: {Thread.CurrentThread.ManagedThreadId}]");

// Unsubscribe callback (if provided) from listen key.
UnsubscribeStream(listenKey, callback);
Expand Down

0 comments on commit 5eb7f32

Please sign in to comment.