diff --git a/CryptoExchange.Net/Converters/BaseConverter.cs b/CryptoExchange.Net/Converters/BaseConverter.cs index a507a18..03f7045 100644 --- a/CryptoExchange.Net/Converters/BaseConverter.cs +++ b/CryptoExchange.Net/Converters/BaseConverter.cs @@ -49,7 +49,7 @@ namespace CryptoExchange.Net.Converters if (!GetValue(stringValue, out var result)) { - Debug.WriteLine($"Cannot map enum. Type: {typeof(T)}, Value: {reader.Value}"); + Trace.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Cannot map enum value. EnumType: {typeof(T)}, Value: {reader.Value}, Known values: {string.Join(", ", Mapping.Select(m => m.Value))}. If you think {reader.Value} should added please open an issue on the Github repo"); return null; } diff --git a/CryptoExchange.Net/Converters/DateTimeConverter.cs b/CryptoExchange.Net/Converters/DateTimeConverter.cs index a49459f..2e08601 100644 --- a/CryptoExchange.Net/Converters/DateTimeConverter.cs +++ b/CryptoExchange.Net/Converters/DateTimeConverter.cs @@ -63,7 +63,7 @@ namespace CryptoExchange.Net.Converters || !int.TryParse(stringValue.Substring(4, 2), out var month) || !int.TryParse(stringValue.Substring(6, 2), out var day)) { - Debug.WriteLine("Unknown DateTime format: " + reader.Value); + Trace.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Unknown DateTime format: " + reader.Value); return default; } return new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Utc); @@ -76,7 +76,7 @@ namespace CryptoExchange.Net.Converters || !int.TryParse(stringValue.Substring(2, 2), out var month) || !int.TryParse(stringValue.Substring(4, 2), out var day)) { - Debug.WriteLine("Unknown DateTime format: " + reader.Value); + Trace.WriteLine("{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Unknown DateTime format: " + reader.Value); return default; } return new DateTime(year + 2000, month, day, 0, 0, 0, DateTimeKind.Utc); @@ -103,7 +103,7 @@ namespace CryptoExchange.Net.Converters || !int.TryParse(values[1], out var month) || !int.TryParse(values[2], out var day)) { - Debug.WriteLine("Unknown DateTime format: " + reader.Value); + Trace.WriteLine("{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Unknown DateTime format: " + reader.Value); return default; } @@ -118,7 +118,7 @@ namespace CryptoExchange.Net.Converters } else { - Debug.WriteLine("Unknown DateTime format: " + reader.Value); + Trace.WriteLine("{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Unknown DateTime format: " + reader.Value); return default; } } diff --git a/CryptoExchange.Net/Converters/EnumConverter.cs b/CryptoExchange.Net/Converters/EnumConverter.cs index 0f9be4b..2732770 100644 --- a/CryptoExchange.Net/Converters/EnumConverter.cs +++ b/CryptoExchange.Net/Converters/EnumConverter.cs @@ -37,7 +37,7 @@ namespace CryptoExchange.Net.Converters if (!GetValue(objectType, mapping, stringValue, out var result)) { - Debug.WriteLine($"Cannot map enum. Type: {objectType.Name}, Value: {reader.Value}"); + Trace.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Cannot map enum value. EnumType: {objectType.Name}, Value: {reader.Value}, Known values: {string.Join(", ", mapping.Select(m => m.Value))}. If you think {reader.Value} should added please open an issue on the Github repo"); return null; } diff --git a/CryptoExchange.Net/ExtensionMethods.cs b/CryptoExchange.Net/ExtensionMethods.cs index de4a859..6779087 100644 --- a/CryptoExchange.Net/ExtensionMethods.cs +++ b/CryptoExchange.Net/ExtensionMethods.cs @@ -267,14 +267,14 @@ namespace CryptoExchange.Net { var info = $"Deserialize JsonReaderException: {jre.Message}, Path: {jre.Path}, LineNumber: {jre.LineNumber}, LinePosition: {jre.LinePosition}. Data: {stringData}"; log?.Write(LogLevel.Error, info); - if (log == null) Debug.WriteLine(info); + if (log == null) Trace.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | {info}"); return null; } catch (JsonSerializationException jse) { var info = $"Deserialize JsonSerializationException: {jse.Message}. Data: {stringData}"; log?.Write(LogLevel.Error, info); - if (log == null) Debug.WriteLine(info); + if (log == null) Trace.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | {info}"); return null; } } diff --git a/CryptoExchange.Net/Logging/Log.cs b/CryptoExchange.Net/Logging/Log.cs index a85117c..1778343 100644 --- a/CryptoExchange.Net/Logging/Log.cs +++ b/CryptoExchange.Net/Logging/Log.cs @@ -65,7 +65,7 @@ namespace CryptoExchange.Net.Logging catch (Exception e) { // Can't write to the logging so where else to output.. - Debug.WriteLine($"Failed to write log to writer {writer.GetType()}: " + e.ToLogString()); + Trace.WriteLine($"{DateTime.Now:yyyy/MM/dd HH:mm:ss:fff} | Warning | Failed to write log to writer {writer.GetType()}: " + e.ToLogString()); } } }