1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-08 16:36:15 +00:00

Replaced Debug.WriteLine with Trace.WriteLine

This commit is contained in:
Jkorf 2022-01-20 16:21:42 +01:00
parent 3cf5480cad
commit 3e23882572
5 changed files with 9 additions and 9 deletions

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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());
}
}
}