Created
March 7, 2024 22:50
-
-
Save niemyjski/465e55a8d019a9260ae6e52d952260d2 to your computer and use it in GitHub Desktop.
.NET always Parsing log formats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void TestLogLevel() | |
{ | |
Log.MinimumLevel = LogLevel.Information; | |
var logger = Log.CreateLogger("TestLogLevel"); | |
logger.LogTrace("({BadBracket}}", Boolean.TrueString); | |
} | |
System.FormatException | |
Input string was not in a correct format. Failure to parse near offset 10. Format item ends prematurely. | |
at System.Text.CompositeFormat.Parse(String format) | |
at Microsoft.Extensions.Logging.LogValuesFormatter..ctor(String format) | |
at Microsoft.Extensions.Logging.FormattedLogValues.<>c.<.ctor>b__9_0(String f) | |
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) | |
at Microsoft.Extensions.Logging.FormattedLogValues..ctor(String format, Object[] values) | |
at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args) | |
at Microsoft.Extensions.Logging.LoggerExtensions.LogTrace(ILogger logger, String message, Object[] args) | |
at Tests.LoggingTests.TestLogLevel() in /Users/blakeniemyjski/test/Tests/LoggingTests.cs:line 24 | |
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) | |
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment