-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve use of Write-Log and exceptions #97
Merged
danbelcher-MSFT
merged 9 commits into
microsoft:master
from
danbelcher-MSFT:user/dabelc/BetterExceptionLogging
Jan 30, 2018
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
90fba07
Add -Exception parameter to Write-Log. Still need documentation and …
e6070d7
- Add the -Exception parameter to Write-Log.
68e4b2c
- Modify existing calls to Write-Log to take advantage of the new -Ex…
7434faa
- Move the logic of Write-LogHelper back into Write-Log.
5499dcb
- Minor change to exception logging in Telemetry.ps1
e4f4aeb
- Revert changes to exception messages for complicated exceptiontypes…
b158ca5
- Rewrite existing uses of Write-Log that are joining the message con…
9732b47
- Use explicit -Message parameer name with Write-Log
79f2610
Bump module version to 1.14.0
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ function Add-ToElement | |
PS C:\>Add-ToElement -Element $root -Comment "Comment1", "Comment2" -Attribute @{ "Attrib1"="Val1"; "Attrib2"="Val2" } | ||
|
||
Adds two comments and two attributes to the root element of the XML document. | ||
|
||
#> | ||
param( | ||
[Parameter(Mandatory)] | ||
|
@@ -229,7 +229,7 @@ function Add-ToChildren | |
} | ||
|
||
Add-ToElement @params | ||
$CountFrom++ | ||
$CountFrom++ | ||
} | ||
} | ||
|
||
|
@@ -502,7 +502,7 @@ function Add-ScreenshotCaptions | |
# https://github.com/PowerShell/PSScriptAnalyzer/issues/699 | ||
$captionImageMap[$description] = @{} | ||
} | ||
|
||
($captionImageMap[$description])[$imageType] = $fileName | ||
} | ||
|
||
|
@@ -903,7 +903,7 @@ function ConvertFrom-Listing | |
xml:lang="{0}" | ||
Release="{1}"/>', $Lang, $Release)) | ||
|
||
Add-AppStoreName -Xml $Xml -Listing $Listing | ||
Add-AppStoreName -Xml $Xml -Listing $Listing | ||
Add-Keywords -Xml $Xml -Listing $Listing | ||
Add-Description -Xml $Xml -Listing $Listing | ||
Add-ReleaseNotes -Xml $Xml -Listing $Listing | ||
|
@@ -1012,11 +1012,10 @@ function Show-ImageFileNames | |
return | ||
} | ||
|
||
$output = @() | ||
$output += "You now need to find all of your images and place them here: <ImagesRootPath>\$Release\<langcode>\..." | ||
$output += " where <ImagesRootPath> is the path defined in your config file," | ||
$output += " and <langcode> is the same langcode for the directory of the PDP file referencing those images." | ||
Write-Log $($output -join [Environment]::NewLine) | ||
Write-Log -Message @( | ||
"You now need to find all of your images and place them here: <ImagesRootPath>\$Release\<langcode>\...", | ||
" where <ImagesRootPath> is the path defined in your config file,", | ||
" and <langcode> is the same langcode for the directory of the PDP file referencing those images.") | ||
|
||
# Quick analysis to help teams out if they need to do anything special with their PDP's | ||
|
||
|
@@ -1044,28 +1043,26 @@ function Show-ImageFileNames | |
# Now show the user the image filenames | ||
if ($imagesDiffer) | ||
{ | ||
$output = @() | ||
$output += "It appears that you don't have consistent images across all languages." | ||
$output += "While StoreBroker supports this scenario, some localization systems may" | ||
$output += "not support this without additional work. Please refer to the FAQ in" | ||
$output += "the documentation for more info on how to best handle this scenario." | ||
Write-Log $($output -join [Environment]::NewLine) -Level Warning | ||
Write-Log -Level Warning -Message @( | ||
"It appears that you don't have consistent images across all languages.", | ||
"While StoreBroker supports this scenario, some localization systems may", | ||
"not support this without additional work. Please refer to the FAQ in", | ||
"the documentation for more info on how to best handle this scenario.") | ||
|
||
$output = @() | ||
$output += "The currently referenced image filenames, per langcode, are as follows:" | ||
foreach ($langCode in ($LangImageNames.Keys.GetEnumerator() | Sort-Object)) | ||
{ | ||
$output += " * [$langCode]: " + ($LangImageNames.$langCode -join ", ") | ||
} | ||
Write-Log $($output -join [Environment]::NewLine) | ||
|
||
Write-Log $output | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
} | ||
else | ||
{ | ||
$output = @() | ||
$output += "Every language that has a PDP references the following images:" | ||
$output += "`t$($seenImages -join `"`n`t`")" | ||
Write-Log $($output -join [Environment]::NewLine) | ||
Write-Log -Message @( | ||
"Every language that has a PDP references the following images:", | ||
"`t$($seenImages -join `"`n`t`")") | ||
} | ||
} | ||
|
||
|
@@ -1105,7 +1102,7 @@ function Main | |
} | ||
catch | ||
{ | ||
Write-Log "Error creating [$lang] PDP: $($Error[0].Exception.Message )" -Level Error | ||
Write-Log "Error creating [$lang] PDP:" -Exception $_ -Level Error | ||
throw | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're here, I'd ask that you explicitly add the
-Message
at the same time, just to help us get up to the consistency we've been working towards.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went all-in and replaced all instances of Write-Log that used implicit -Message parameter.