cleanup logging

This commit is contained in:
2020-09-19 16:40:07 -04:00
parent 85f923f77d
commit 545701705d
+4 -3
View File
@@ -26,11 +26,12 @@ Function Log
{
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)][string]$Message,
[Parameter(Mandatory=$false)][switch]$Error,
[Parameter(Mandatory=$false)][switch]$Error=$false,
[Parameter(Mandatory=$false)][string]$LogName
)
If ( $Error ) { $LogEntry = "{0} - Error: {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $Message }
Else { $LogEntry = "{0} - {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $Message }
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
If ( $Error ) { $LogEntry = "${Timestamp} - Error: ${Message}" }
Else { $LogEntry = "${Timestamp} - ${Message}" }
If ( $LogName )
{
$LogFile = "${MSPLogs}\${LogFilePrefix}-${LogName}.log"