Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions platform-includes/logs/options/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Experimental.EnableLogs
#### EnableLogs

<PlatformSection notSupported={["dotnet.aspnetcore", "dotnet.azure-functions-worker", "dotnet.blazor-webassembly", "dotnet.extensions-logging", "dotnet.maui", "dotnet.serilog"]}>
Set to `true` in order to enable the `SentrySdk.Logger` APIs.
Expand All @@ -12,17 +12,17 @@ Set to `true` in order to enable the logging integration via the `ILogger<TCateg
Set to `true` in order to enable the logging integration via the `Log`/`Logger` APIs.
</PlatformSection>

#### Experimental.SetBeforeSendLog
#### SetBeforeSendLog

To filter logs, or update them before they are sent to Sentry, you can use the `Experimental.SetBeforeSendLog(Func<SentryLog, SentryLog?>)` option.
To filter logs, or update them before they are sent to Sentry, you can use the `SetBeforeSendLog(Func<SentryLog, SentryLog?>)` option.

```csharp
options =>
{
options.Dsn = "___PUBLIC_DSN___";
options.Experimental.EnableLogs = true;
options.EnableLogs = true;
// a callback that is invoked before sending a log to Sentry
options.Experimental.SetBeforeSendLog(static log =>
options.SetBeforeSendLog(static log =>
{
// filter out all info logs
if (log.Level is SentryLogLevel.Info)
Expand All @@ -44,7 +44,7 @@ options =>
});
```

The callback function set via `Experimental.SetBeforeSendLog(Func<SentryLog, SentryLog?>)` receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it.
The callback function set via `SetBeforeSendLog(Func<SentryLog, SentryLog?>)` receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it.

The log object of type `SentryLog` has the following members:
- `Timestamp` Property: (`DateTimeOffset`) The timestamp of the log.
Expand Down
14 changes: 6 additions & 8 deletions platform-includes/logs/setup/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
To enable logging, you need to initialize the SDK with the `Experimental.EnableLogs` option set to `true`.
To enable logging, you need to initialize the SDK with the `EnableLogs` option set to `true`.

<PlatformSection notSupported={["dotnet.aspnetcore", "dotnet.aws-lambda", "dotnet.azure-functions-worker", "dotnet.blazor-webassembly", "dotnet.extensions-logging", "dotnet.maui", "dotnet.serilog"]}>

Expand All @@ -7,7 +7,7 @@ SentrySdk.Init(options =>
{
options.Dsn = "___PUBLIC_DSN___";
// Enable logs to be sent to Sentry
options.Experimental.EnableLogs = true;
options.EnableLogs = true;
});
```

Expand All @@ -20,7 +20,7 @@ SentrySdk.Init(options =>
{
options.Dsn = "___PUBLIC_DSN___";
// Enable logs to be sent to Sentry
options.Experimental.EnableLogs = true;
options.EnableLogs = true;
});
```

Expand All @@ -33,7 +33,7 @@ SentrySdk.Init(options =>
{
options.Dsn = "___PUBLIC_DSN___";
// Enable logs to be sent to Sentry
options.Experimental.EnableLogs = true;
options.EnableLogs = true;
});
```

Expand All @@ -45,9 +45,7 @@ SentrySdk.Init(options =>
{
"Sentry": {
"Dsn": "___PUBLIC_DSN___",
"Experimental": {
"EnableLogs": true
}
"EnableLogs": true
}
}
```
Expand All @@ -61,7 +59,7 @@ SentrySdk.Init(options =>
{
options.Dsn = "___PUBLIC_DSN___";
// Enable logs to be sent to Sentry
options.Experimental.EnableLogs = true;
options.EnableLogs = true;
});
```

Expand Down
5 changes: 0 additions & 5 deletions platform-includes/logs/usage/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ SentrySdk.Logger.LogInfo("A simple log message");
SentrySdk.Logger.LogError("A {0} log message", "formatted");
```

<Alert title="Note">
During the experimental phase of the feature, we will provide more method overloads for convenient invocation in common scenarios.
Additionally, we may provide method overloads that are not based on _composite format strings_, but on _interpolated strings_.
</Alert>

</PlatformSection>

<PlatformSection supported={["dotnet.aspnetcore", "dotnet.azure-functions-worker", "dotnet.blazor-webassembly", "dotnet.extensions-logging", "dotnet.maui"]}>
Expand Down
Loading