Skip to content

Commit 983485b

Browse files
minor logging updates
1 parent e3931e6 commit 983485b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

Modules/CippEntrypoints/CippEntrypoints.psm1

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function Receive-CippHttpTrigger {
2121
if ($Request.Headers.'x-ms-coldstart' -eq 1) {
2222
Write-Information '** Function app cold start detected **'
2323
}
24+
Write-Information "CIPP_ACTION=$($Request.Params.CIPPEndpoint)"
2425

2526
$ConfigTable = Get-CIPPTable -tablename Config
2627
$Config = Get-CIPPAzDataTableEntity @ConfigTable -Filter "PartitionKey eq 'OffloadFunctions' and RowKey eq 'OffloadFunctions'"
@@ -171,7 +172,7 @@ function Receive-CippOrchestrationTrigger {
171172
Entrypoint
172173
#>
173174
param($Context)
174-
175+
Write-Information "CIPP_ACTION=$($Item.Command ?? $Item.FunctionName)"
175176
try {
176177
if (Test-Json -Json $Context.Input) {
177178
$OrchestratorInput = $Context.Input | ConvertFrom-Json
@@ -286,6 +287,7 @@ function Receive-CippActivityTrigger {
286287
Entrypoint
287288
#>
288289
param($Item)
290+
Write-Information "CIPP_ACTION=$($Item.Command ?? $Item.FunctionName)"
289291
Write-Warning "Hey Boo, the activity function is running. Here's some info: $($Item | ConvertTo-Json -Depth 10 -Compress)"
290292
try {
291293
$Output = $null
@@ -358,12 +360,8 @@ function Receive-CippActivityTrigger {
358360
}
359361

360362
try {
361-
Write-Verbose "Activity starting Function: $FunctionName."
362-
363-
# Wrap the function execution with telemetry
364-
$Output = Measure-CippTask -TaskName $taskName -Metadata $metadata -Script {
365-
Invoke-Command -ScriptBlock { & $FunctionName -Item $Item }
366-
}
363+
Write-Verbose "Activity starting Function: $FunctionName."
364+
Invoke-Command -ScriptBlock { & $FunctionName -Item $Item }
367365
$Status = 'Completed'
368366

369367
Write-Verbose "Activity completed Function: $FunctionName."
@@ -421,8 +419,6 @@ function Receive-CIPPTimerTrigger {
421419

422420
$UtcNow = (Get-Date).ToUniversalTime()
423421
$Functions = Get-CIPPTimerFunctions
424-
Write-Host "CIPP Timer Trigger executed at $UtcNow. Found $($Functions.Count) functions to evaluate. The names are as follows: $($Functions.Command -join ', ')"
425-
Write-Host "CIPPTIMER: $($Functions | ConvertTo-Json -Depth 10 -Compress)"
426422
$Table = Get-CIPPTable -tablename CIPPTimers
427423
$Statuses = Get-CIPPAzDataTableEntity @Table
428424
$FunctionName = $env:WEBSITE_SITE_NAME
@@ -481,9 +477,9 @@ function Receive-CIPPTimerTrigger {
481477
}
482478

483479
# Wrap the timer function execution with telemetry
484-
$Results = Measure-CippTask -TaskName $Function.Command -Metadata $metadata -Script {
485-
Invoke-Command -ScriptBlock { & $Function.Command @Parameters }
486-
}
480+
481+
Invoke-Command -ScriptBlock { & $Function.Command @Parameters }
482+
487483

488484
if ($Results -match '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') {
489485
$FunctionStatus.OrchestratorId = $Results -join ','

0 commit comments

Comments
 (0)