460 B
Executable File
460 B
Executable File
enum LogLevel { INFO WARN ERROR DEBUG }
function Write-Log { param( [string]$Message, [LogLevel]$Level = [LogLevel]::INFO )
$ts = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$line = "[$ts][$Level] $Message"
switch ($Level) {
"INFO" { Write-Host $line -ForegroundColor Gray }
"WARN" { Write-Host $line -ForegroundColor Yellow }
"ERROR" { Write-Host $line -ForegroundColor Red }
"DEBUG" { Write-Host $line -ForegroundColor DarkGray }
}
}