$cs.Job_EnableLog
Description
Section titled “Description”Re-enables logging that was previously turned off with $cs.Job_DisableLog.
Syntax
Section titled “Syntax”$cs.Job_EnableLog(string text = null)
Parameters
Section titled “Parameters”text (String)
Section titled “text (String)”Optional text to write to the log once, after logging is switched back on. If omitted, nothing is logged.
Return value
Section titled “Return value”None
Example
Section titled “Example”Re-enable logging after a single suppressed check:
$cs.Job_DisableLog("Temporarily disabling logging while checking for optional component")$installed = $cs.MSI_IsMSIGuidInstalled('{AC76BA86-1033-FF00-7760-BC15014EA700}')$cs.Job_EnableLog("Re-enabling logging")Re-enable logging after wrapping a single noisy native command, and log a short summary of the result once logging is back on:
$cs.Job_DisableLog("Silencing log while running vendor CLI health check")$result = & "$global:Packageroot\tools\healthcheck.exe" --quiet$exitCode = $LASTEXITCODE$cs.Job_EnableLog("Health check finished with exit code $exitCode")Wrap the suppressed section in try/finally so logging is guaranteed to be re-enabled even if the check throws an unexpected error:
try { $cs.Job_DisableLog("Silencing log while checking for a flaky optional dependency") $installed = $cs.MSI_IsMSIGuidInstalled('{AC76BA86-1033-FF00-7760-BC15014EA700}')} finally { $cs.Job_EnableLog("Re-enabling logging")}