Write-UcmLog

Function to output messages to the console based on their severity and create log files

Description

Basic log file and user feedback function, allows for logging only, log levels logs hostname/time etc

Parameters

Message (Required)

The message to write

Path (optional)

The location of the logfile, will default to the script variable $Script:LogFileLocation if not specified

Severity

Sets the severity of the log message, Higher severities will call Write-Warning or Write-Error

Component

Used to track the module or function that called "Write-Log"

LogOnly

Forces Write-Log to not display anything to the user

Example

Write-Log -Message 'This is a log message' -Severity 3 -component 'Example Component' Writes a log file message and displays a warning to the user

Write-Log -Message 'This is a log message' -Severity 3 -component 'Example Component' 
# Writes a log file message and displays a warning to the user

Last updated