Make TestApplicationErrorLogger thread-safe
This commit is contained in:
parent
2016578f4e
commit
b2d45c3dd0
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Internal;
|
using Microsoft.AspNetCore.Server.Kestrel.Internal;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
// Application errors are logged using 13 as the eventId.
|
// Application errors are logged using 13 as the eventId.
|
||||||
private const int ApplicationErrorEventId = 13;
|
private const int ApplicationErrorEventId = 13;
|
||||||
|
|
||||||
public List<LogMessage> Messages { get; } = new List<LogMessage>();
|
public ConcurrentBag<LogMessage> Messages { get; } = new ConcurrentBag<LogMessage>();
|
||||||
|
|
||||||
public int TotalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Error);
|
public int TotalErrorsLogged => Messages.Count(message => message.LogLevel == LogLevel.Error);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue