Skip to content

$cs.Log_SectionHeader

Writes a decorative bordered section-header block into the log, to visually separate a group of related log entries. This is called at the top of every function in the PowerPack script template.

$cs.Log_SectionHeader(string name, char framecharacter = ‘o’)

Name to display in the section header.

Character used to build the border around the section header. Defaults to 'o'.

None

Terminal window
function Install {
$cs.Log_SectionHeader('Install', 'o')
$cs.Job_WriteLog("Starting installation of $global:AppName $global:AppRelease")
}

Result in the log:

2022-03-16 13:38:19 - oooooooooooooooooooooooooooooooooooooooooooooooooooooo
2022-03-16 13:38:19 - o Install o
2022-03-16 13:38:19 - oooooooooooooooooooooooooooooooooooooooooooooooooooooo

The same pattern is used at the top of every template function, for example PreInstall and PostInstall, so the log clearly shows where each phase begins:

Terminal window
function PreInstall {
$cs.Log_SectionHeader('PreInstall', 'o')
$cs.Job_WriteLog("Checking prerequisites for $global:AppName $global:AppRelease")
}
function PostInstall {
$cs.Log_SectionHeader('PostInstall', 'o')
$cs.Job_WriteLog("Running post-install cleanup for $global:AppName $global:AppRelease")
}

$cs.Job_WriteLog