Skip to content

Add test for scriptblock logging for macOS - #7586

Merged
Travis Plunk (TravisEz13) merged 2 commits into
PowerShell:masterfrom
TravisEz13:Add_ScriptBlockLogging_Tests
Aug 21, 2018
Merged

Travis Plunk (TravisEz13) merged 2 commits into
PowerShell:masterfrom
TravisEz13:Add_ScriptBlockLogging_Tests

Conversation

@TravisEz13

@TravisEz13 Travis Plunk (TravisEz13) commented Aug 21, 2018 •

Copy link
Copy Markdown
Member

PR Summary

Add test for scriptblock logging

PR Checklist

@TravisEz13 Travis Plunk (TravisEz13) changed the title Add test for scriptblock logging Add test for scriptblock logging for macOS Aug 21, 2018

@dantraMSFT Dan Travison (dantraMSFT) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments; otherwise LGTM.


if($item.LogId -notmatch '^\[com\.microsoft\.powershell')
{
Write-Verbose "logId: $($item.LogId)" -Verbose

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest changing the verbose message slightly, to something like:

"Skipping logId: $($item.LogId)"

{
[string] $filter = [string]::Format("com.microsoft.powershell.{0}: (", $id)
Get-Content @contentParms -filter {$_.Contains($filter)} | ConvertFrom-OsLog -Id $Id -After $After | Select-Object -First $maxItems
Write-Warning "this code path `Get-PSOsLog -TotalCount` should not be used if the message field is needed!"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest filing an issue against this. The intent is for the entire log entry to be returned even when using TotalCount.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I filed #7589

@anmenaga Andrew (anmenaga) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TravisEz13

Copy link
Copy Markdown
Member Author

I also submitted #7588 to fix the issue with window VSTS

@TravisEz13
Travis Plunk (TravisEz13) merged commit 849f6fb into PowerShell:master Aug 21, 2018
@TravisEz13
Travis Plunk (TravisEz13) deleted the Add_ScriptBlockLogging_Tests branch August 21, 2018 20:21
@TravisEz13 Travis Plunk (TravisEz13) added this to the v6.1.0 milestone Aug 23, 2018
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants