Skip to content

Commit 79bfb2d

Browse files
Minor refactoring
- Tidy up whitespace. - Use expression-bodied property. - Use interpolated string.
1 parent f9f9212 commit 79bfb2d

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/Logging.XUnit/XUnitLogger.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ private XUnitLogger(string name, XUnitLoggerOptions? options)
6363
/// </exception>
6464
public Func<string?, LogLevel, bool> Filter
6565
{
66-
get { return _filter; }
67-
set { _filter = value ?? throw new ArgumentNullException(nameof(value)); }
66+
get => _filter;
67+
set => _filter = value ?? throw new ArgumentNullException(nameof(value));
6868
}
6969

7070
/// <summary>
@@ -228,17 +228,11 @@ private static string GetLogLevelString(LogLevel logLevel)
228228
return logLevel switch
229229
{
230230
LogLevel.Critical => "crit",
231-
232231
LogLevel.Debug => "dbug",
233-
234232
LogLevel.Error => "fail",
235-
236233
LogLevel.Information => "info",
237-
238234
LogLevel.Trace => "trce",
239-
240235
LogLevel.Warning => "warn",
241-
242236
_ => throw new ArgumentOutOfRangeException(nameof(logLevel)),
243237
};
244238
}
@@ -267,10 +261,10 @@ private static void GetScopeInformation(StringBuilder builder)
267261
foreach (var property in StringifyScope(elem))
268262
{
269263
builder.Append(MessagePadding)
270-
.Append(DepthPadding(depth))
271-
.Append("=> ")
272-
.Append(property)
273-
.AppendLine();
264+
.Append(DepthPadding(depth))
265+
.Append("=> ")
266+
.Append(property)
267+
.AppendLine();
274268
}
275269

276270
depth++;
@@ -288,7 +282,7 @@ private static IEnumerable<string> StringifyScope(XUnitLogScope scope)
288282
{
289283
foreach (var pair in pairs)
290284
{
291-
yield return pair.Key + ": " + pair.Value;
285+
yield return $"{pair.Key}: {pair.Value}";
292286
}
293287
}
294288
else if (scope.State is IEnumerable<string> entries)

0 commit comments

Comments
 (0)