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

Log sync errors in client logger interceptor example #1868

Merged
merged 3 commits into from
Aug 31, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 30, 2022

Fixes #1864

// https://docs.microsoft.com/aspnet/core/grpc/diagnostics#grpc-client-logging
var initialColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Call error: {ex.Message}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Console.WriteLine($"Call error: {ex.Message}");
Console.WriteError($"Call error: {ex.Message}");

Or is there no particular need to specifically map to stderr here?

{
// Log error to the console.
// Note: Configuring .NET Core logging is the recommended way to log errors
// https://docs.microsoft.com/aspnet/core/grpc/diagnostics#grpc-client-logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not configure the sample to use the logging primitives then? Looks like it should be really easy.

@JamesNK JamesNK merged commit 937869c into grpc:master Aug 31, 2022
@JamesNK JamesNK deleted the jamesnk/clientlogger-sync branch August 31, 2022 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implicit behavior if continuation thrown exception synchronously
3 participants