diff --git a/CHANGELOG.md b/CHANGELOG.md index e39921f..8fa4067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Don't log debug messages if `-Debug` wasn't set ([#75](https://github.com/getsentry/sentry-powershell/pull/75)) + ### Dependencies - Bump Dotnet SDK from v4.12.1 to v4.13.0 ([#69](https://github.com/getsentry/sentry-powershell/pull/69)) diff --git a/modules/Sentry/private/DiagnosticLogger.ps1 b/modules/Sentry/private/DiagnosticLogger.ps1 index 3732b3e..ab4efc7 100644 --- a/modules/Sentry/private/DiagnosticLogger.ps1 +++ b/modules/Sentry/private/DiagnosticLogger.ps1 @@ -53,7 +53,12 @@ class DiagnosticLogger : Sentry.Extensibility.IDiagnosticLogger { # Workaround for Windows Powershell issue of halting and asking for user confirmation. # see https://github.com/PowerShell/PowerShell/issues/5148 - $DebugPreference = 'Continue' + if ($global:PSVersionTable.PSEdition -eq 'Desktop') { + $pref = Get-Variable DebugPreference + if ($pref.value -eq "Inquire") { + $DebugPreference = 'Continue' + } + } Write-Debug $message }