Replies: 1 comment 1 reply
-
I ended up creating an extension method that looks like this: public static class LoggingExtensions
{
public static void LogWithSentryScope(
this ILogger logger,
string? message,
Action<Scope> configureScope,
LogLevel logLevel = LogLevel.Information
)
{
using var _ = SentrySdk.PushScope();
SentrySdk.ConfigureScope(configureScope);
logger.Log(logLevel, message);
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
We use the deprecated
WithScope
in a few places, and is looking to replace it but we can´t find out how. We want to log to console and to Sentry. The log to Sentry should include custom tags and context. In the example below I have tried different scenarios but the only scenario that replacesWithScope
looks like this:And that does not look very good.
Full code here
SentryScopeService.cs
Program.cs
SentryScopeExample.csproj
(See also discussion here)
Beta Was this translation helpful? Give feedback.
All reactions