Initialer Import der Synology Scripts
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
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 }
|
||||
}
|
||||
```
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user