Version 1.4c

This commit is contained in:
Madzone
2026-08-07 01:46:47 +02:00
parent d5baac7c4d
commit 6ce77b0a89
+8 -72
View File
@@ -1166,13 +1166,6 @@ function Initialize-EnterpriseLog {
function Write-EnterpriseLog {
<#
.SYNOPSIS
Schreibt Enterprise Log Einträge.
#>
param(
[ValidateSet(
@@ -1184,91 +1177,34 @@ function Write-EnterpriseLog {
[string]$Level = "INFO",
[Parameter(Mandatory)]
[string]$Message
)
if(!$Script:LogFile)
if([string]::IsNullOrWhiteSpace($Script:LogFile))
{
Initialize-EnterpriseLog |
Out-Null
Initialize-EnterpriseLog | Out-Null
}
$Entry =
[PSCustomObject]@{
$Time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Time =
Get-Date
Level =
$Level
Computer =
$env:COMPUTERNAME
User =
$env:USERNAME
Message =
$Line = "{0} [{1}] {2} {3}" -f `
$Time,
$Level,
$env:COMPUTERNAME,
$Message
}
$Line =
(
$Entry.Time.ToString(
"yyyy-MM-dd HH:mm:ss"
)
) +
" [" +
$Entry.Level +
"] " +
$Entry.Message
Add-Content `
-Path $Script:LogFile `
-Value $Line
return $Entry
return $Line
}