Skip to content

Commit 0e39178

Browse files
committed
Remove string interpolation
1 parent 24daf0c commit 0e39178

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ CancellationToken cancellationToken
128128
var context = result.OpenApiDiagnostic;
129129
if (context.Errors.Count > 0)
130130
{
131+
logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count);
132+
131133
var errorReport = new StringBuilder();
132134

133135
foreach (var error in context.Errors)
134136
{
137+
logger.LogError("OpenApi Parsing error: {message}", error.ToString());
135138
errorReport.AppendLine(error.ToString());
136139
}
137140
logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}");
@@ -282,9 +285,9 @@ private static async Task<Stream> GetStream(string input, ILogger logger, Cancel
282285
catch (HttpRequestException ex)
283286
{
284287
#if DEBUG
285-
logger.LogCritical(ex, $"Could not download the file at {input}, reason: {ex.Message}");
288+
logger.LogCritical(ex, "Could not download the file at {inputPath}, reason: {exMessage}", input, ex.Message);
286289
#else
287-
logger.LogCritical($"Could not download the file at {input}, reason: {ex.Message}", input, ex.Message);
290+
logger.LogCritical( "Could not download the file at {inputPath}, reason: {exMessage}", input, ex.Message);
288291
#endif
289292
return null;
290293
}
@@ -305,9 +308,9 @@ ex is SecurityException ||
305308
ex is NotSupportedException)
306309
{
307310
#if DEBUG
308-
logger.LogCritical(ex, $"Could not open the file at {input}, reason: {ex.Message}");
311+
logger.LogCritical(ex, "Could not open the file at {inputPath}, reason: {exMessage}", input, ex.Message);
309312
#else
310-
logger.LogCritical($"Could not open the file at {input}, reason: {ex.Message}");
313+
logger.LogCritical("Could not open the file at {inputPath}, reason: {exMessage}", input, ex.Message);
311314
#endif
312315
return null;
313316
}

0 commit comments

Comments
 (0)