Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Bitfinex.Client.Websocket/Client/BitfinexLogger.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace Bitfinex.Client.Websocket.Client
using Bitfinex.Client.Websocket.Communicator;

namespace Bitfinex.Client.Websocket.Client
{
internal static class BitfinexLogger
{
public static string L(string msg)
public static string L(string msg, IBitfinexCommunicator communicator)
{
return $"[BFX WEBSOCKET CLIENT] {msg}";
return $"[{communicator.Name ?? "BFX"} WEBSOCKET CLIENT] {msg}";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void Send<T>(T request)
}
catch (Exception e)
{
_logger.LogError(e, L("Exception while sending message '{request}'. Error: {error}"), request, e.Message);
_logger.LogError(e, L("Exception while sending message '{request}'. Error: {error}", _communicator), request, e.Message);
throw;
}
}
Expand Down Expand Up @@ -122,7 +122,7 @@ private void HandleConfiguration(ConfigurationResponse response)
}
catch (Exception e)
{
_logger.LogError(e, L("Exception while received configuration, error: {error}"), e.Message);
_logger.LogError(e, L("Exception while received configuration, error: {error}", _communicator), e.Message);
}
}

Expand All @@ -146,7 +146,7 @@ private void HandleMessage(ResponseMessage message)
}
catch (Exception e)
{
_logger.LogError(e, L("Exception while receiving message, error: {error}"), e.Message);
_logger.LogError(e, L("Exception while receiving message, error: {error}", _communicator), e.Message);
}
}

Expand All @@ -155,7 +155,7 @@ private void OnArrayMessage(string msg)
var parsed = BitfinexSerialization.Deserialize<JArray>(msg);
if (parsed.Count() < 2)
{
_logger.LogWarning(L("Invalid message format, too low items"));
_logger.LogWarning(L("Invalid message format, too low items", _communicator));
return;
}

Expand Down
Loading