LANCommander.Servers.Base/Modules/Logging/Logging.psm1
2026-01-21 19:37:19 -06:00

28 lines
713 B
PowerShell

Set-StrictMode -Version Latest
function Write-Log {
[CmdletBinding()]
param(
[Parameter(Mandatory, Position = 0)]
[string]$Message,
[Parameter()]
[string]$Prefix = '[LANCommander]',
[Parameter()]
[ValidateSet('Info','Debug','Verbose','Warning','Error')]
[string]$Level = 'Info'
)
$text = "$Prefix $Message"
switch ($Level) {
'Debug' { Write-Debug $text }
'Verbose' { Write-Verbose $text }
'Warning' { Write-Warning $text }
'Error' { Write-Host $text -ForegroundColor Red }
default { Write-Information $text -InformationAction Continue }
}
}
Export-ModuleMember -Function Write-Log