Skip to content

Commit 31b2ea2

Browse files
sdk(dotnet): diagnostic logger pointer (#4143)
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
1 parent 018d5c2 commit 31b2ea2

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

src/platforms/dotnet/configuration/diagnostic-logger.mdx renamed to src/includes/configuration/diagnostic-logger/dotnet.mdx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
---
2-
title: Diagnostic Logger
3-
description: "Learn more about enabling SDK logging to help troubleshooting."
4-
sidebar_order: 20
5-
---
61

72
Sentry's SDK includes its own internal logger to report diagnostics that may be useful when troubleshooting your Sentry configuration. To enable logging, set the `Debug` option to `true`:
83

@@ -24,14 +19,14 @@ options =>
2419

2520
By default, Sentry will write diagnostic messages to console. This may not be optimal in some circumstances; for example, when running applications that don't have a visible console window attached.
2621

27-
To use a custom implementation of `IDiagnosticLogger`, you can pass it to the `DiagnosticLogger` option. Sentry comes with two implementations out of the box: `ConsoleDiagnosticLogger` and `DebugDiagnosticLogger`.
22+
To use a custom implementation of `IDiagnosticLogger`, you can pass it to the `DiagnosticLogger` option. Sentry comes with two implementations out of the box: `ConsoleDiagnosticLogger` and `TraceDiagnosticLogger`.
2823

2924
```csharp
3025
// Provide a custom logger
31-
options.DiagnosticLogger = new DebugDiagnosticLogger(SentryLevel.Debug);
26+
options.DiagnosticLogger = new TraceDiagnosticLogger(SentryLevel.Debug);
3227
```
3328

34-
The logger `DebugDiagnosticLogger` in the example uses the [.NET's Debug class](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debug). As a result, you can view the SDK logs inside Visual Studio's Debug log window, which is useful for technologies that don't have a Console to see the log messages, such as `WPF` and `ASP.NET`.
29+
The logger `TraceDiagnosticLogger` in the example uses the [.NET's Trace class](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.trace). As a result, you can view the SDK logs inside Visual Studio's Debug log window, which is useful for technologies that don't have a Console to see the log messages, such as `WinForms`, `WPF` and `ASP.NET`.
3530

3631
You can also create your own implementation of `IDiagnosticLogger` to fully customize logging behavior. For example, to naively append diagnostic messages to a file:
3732

src/platforms/common/configuration/options.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ Enabling `debug` mode makes the SDK generate as much diagnostic data as possible
5959

6060
</ConfigKey>
6161

62+
<PlatformSection supported={["dotnet"]}>
63+
64+
For app models that don't have a console to print to, you can <PlatformLink to="/configuration/diagnostic-logger/">customize the SDK's diagnostic logger</PlatformLink> to write to a file or to Visual Studio's debug window.
65+
66+
</PlatformSection>
67+
6268
<ConfigKey name="release">
6369

6470
Sets the release. Some SDKs will try to automatically configure a release out of the box but it's a better idea to manually set it to guarantee that the release is in sync with your deploy integrations or source map uploads. Release names are strings, but some formats are detected by Sentry and might be rendered differently. Learn more about how to send release data so Sentry can tell you about regressions between releases and identify the potential source in [the releases documentation](/product/releases/).

src/platforms/common/enriching-events/attachments/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ supported:
99
- java
1010
- javascript
1111
- dotnet
12+
- unity
1213
- dart
1314
- flutter
1415
---
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Diagnostic Logger
3+
description: "Learn more about enabling SDK logging to help troubleshooting."
4+
sidebar_order: 20
5+
---
6+
7+
<PlatformContent includePath="configuration/diagnostic-logger" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Diagnostic Logger
3+
description: "Learn more about enabling SDK logging to help troubleshooting."
4+
sidebar_order: 20
5+
---
6+
7+
<PlatformContent includePath="configuration/diagnostic-logger" />

0 commit comments

Comments
 (0)