Skip to content

Commit 895ef11

Browse files
🩹 [Patch]: Add logging for [System.Environment] properties (#7)
## Description This pull request includes an enhancement to the `scripts/main.ps1` file by adding a new logging group for listing `[System.Environment]` static properties. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent a10212b commit 895ef11

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/main.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ LogGroup 'Environment Variables' {
7474
Get-ChildItem env: | Where-Object { $_.Name -notlike 'CONTEXT_*' } | Sort-Object Name | Format-Table -AutoSize -Wrap
7575
}
7676

77+
LogGroup '[System.Environment]' {
78+
$props = @{}
79+
$propsObject = [PSCustomObject]@{}
80+
[System.Environment] | Get-Member -Static -MemberType Property | Where-Object { $_.Name -notin 'StackTrace' } |
81+
ForEach-Object {
82+
$props[$_.Name] = [System.Environment]::$($_.Name)
83+
}
84+
$props.GetEnumerator() | Sort-Object Name | ForEach-Object {
85+
$propsObject | Add-Member -MemberType NoteProperty -Name $_.Name -Value $_.Value
86+
}
87+
$propsObject | Format-List
88+
}
89+
7790
LogGroup 'PowerShell variables' {
7891
Get-Variable | Where-Object { $_.Name -notlike 'CONTEXT_*' } | Sort-Object Name | Format-Table -AutoSize -Wrap
7992
}

0 commit comments

Comments
 (0)