Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormatException is thrown if the log message string contains "{". #11

Closed
mxProject opened this issue May 9, 2020 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@mxProject
Copy link

Hello @neuecc .

FormatException is thrown if the log message string contains "{".

Configure the console logger by calling the AddZLoggerConsole method.

await MagicOnionHost.CreateDefaultBuilder()
.UseMagicOnion(options, new ServerPort("localhost", port, credentials))
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddZLoggerConsole(options =>
{
options.EnableStructuredLogging = false;
}
);
}
)
.RunConsoleAsync().ConfigureAwait(false);

Outputs a string containing "{" to the logger.

logger.ZLogInformation("{abc=1}");

FormatException is thrown.

System.FormatException: Input string was not in a correct format.
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at Cysharp.Text.FormatParser.Parse(ReadOnlySpan1 format) at Cysharp.Text.ZString.Utf8Format[T1](IBufferWriter1 bufferWriter, String format, T1 arg1)
at ZLogger.Entries.FormatLogEntry2.FormatUtf8(IBufferWriter1 writer, ZLoggerOptions options, Utf8JsonWriter jsonWriter)
at ZLogger.AsyncStreamLineMessageWriter.WriteLoop()

@neuecc neuecc added the bug Something isn't working label May 10, 2020
@neuecc
Copy link
Member

neuecc commented May 10, 2020

Thank you for reporting.
Currently Log(string msg) redirected to Log(string format, object null), which is causing an error.
I'll fix soon.

neuecc added a commit that referenced this issue May 10, 2020
@neuecc
Copy link
Member

neuecc commented May 10, 2020

Now I've releade 1.2.1 it includes this fix.

@neuecc neuecc closed this as completed May 10, 2020
@mxProject
Copy link
Author

Thanks @neuecc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants