Public/func_LogIt.ps1
<#
.SYNOPSIS A function I got from the Internet that replaces write-host and adds a timestamp to the message. .DESCRIPTION A function I got from the Internet that replaces write-host and adds a timestamp to the message. .NOTES Author: Someone on the Internet Version: 2023.05.23.1600 .CHANGELOG 2023.03.13.1600 - Initial Version of this as a func 2023.03.13.2300 - Added the Process block for advanced functions 2023.05.23.1600 - Added a DESCRIPTION section in the script header. #> function LogIt{ [CmdletBinding()] Param( [Parameter(Position = 0, Mandatory = $true)] [String]$Message ) Process{ $currentTime = Get-Date -Format "hh:mm:ss" $loggedText = "[{0}] {1}" -f $currentTime,$Message write-Output $loggedText -ForegroundColor Green } } |