$cs.Log_SectionHeader
Description
Section titled “Description”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.
After a section header, every following log line is prefixed with the section name, for example Install: , until the next section header. This makes it easy to see which phase wrote a line.
Syntax
Section titled “Syntax”$cs.Log_SectionHeader(string name, char framecharacter = ‘o’)
Parameters
Section titled “Parameters”name (String)
Section titled “name (String)”Name to display in the section header.
framecharacter (Char)
Section titled “framecharacter (Char)”Character used to build the border around the section header. Defaults to 'o'.
Return value
Section titled “Return value”None
Example
Section titled “Example”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 - oooooooooooooooooooooooooooooooooooooooooooooooooooooo2022-03-16 13:38:19 - o Install o2022-03-16 13:38:19 - oooooooooooooooooooooooooooooooooooooooooooooooooooooo2022-03-16 13:38:19 - Install: Starting installation of Contoso App 1.0The 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:
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")}