Skip to content

Commit 94ec5c2

Browse files
committed
add script name
1 parent 2255fb8 commit 94ec5c2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/Invoke-CodeGen.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function Invoke-ScriptWithLogging {
3434

3535

3636
$script:startTime = Get-Date
37+
$scriptName = $MyInvocation.MyCommand.Name
3738

3839
function Write-ElapsedTime {
3940
[CmdletBinding()]
@@ -43,7 +44,7 @@ function Write-ElapsedTime {
4344
)
4445

4546
$elapsedTime = [math]::Round(((Get-Date) - $script:startTime).TotalSeconds, 1)
46-
Write-Host "${Message}. Total elapsed time: $elapsedTime seconds"
47+
Write-Host "[${scriptName}] ${Message}. Total elapsed time: $elapsedTime seconds."
4748
Write-Host ""
4849
}
4950

@@ -305,6 +306,4 @@ finally {
305306
Pop-Location
306307
}
307308

308-
$scriptName = $MyInvocation.MyCommand.Name
309-
310-
Write-ElapsedTime "${scriptName} completed"
309+
Write-ElapsedTime "Script completed"

0 commit comments

Comments
 (0)