Skip to content

Commit ff7d911

Browse files
authored
fix: don't log if Debug=$false (#75)
* fix: don't log on windows-powershell if debug=false * chore: changelog * Update CHANGELOG.md
1 parent 5f94153 commit ff7d911

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Don't log debug messages if `-Debug` wasn't set ([#75](https://github.com/getsentry/sentry-powershell/pull/75))
8+
59
### Dependencies
610

711
- Bump Dotnet SDK from v4.12.1 to v4.13.0 ([#69](https://github.com/getsentry/sentry-powershell/pull/69))

modules/Sentry/private/DiagnosticLogger.ps1

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ class DiagnosticLogger : Sentry.Extensibility.IDiagnosticLogger
5353
{
5454
# Workaround for Windows Powershell issue of halting and asking for user confirmation.
5555
# see https://github.com/PowerShell/PowerShell/issues/5148
56-
$DebugPreference = 'Continue'
56+
if ($global:PSVersionTable.PSEdition -eq 'Desktop') {
57+
$pref = Get-Variable DebugPreference
58+
if ($pref.value -eq "Inquire") {
59+
$DebugPreference = 'Continue'
60+
}
61+
}
5762

5863
Write-Debug $message
5964
}

0 commit comments

Comments
 (0)