Version 1.4c

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