Structured logging PowerShell module.
- OTel numeric severity logs
- Writes JSONL output.
- Export logs to Loki via tailing JSONL logs. Vector included for this in compose.
- Push spans/traces over OTLP. Measure time to execute script blocks.
- Console output still works normally. WinEvent if you're a goofy guy.
# set environment variables for OTel.
$env:PSLOGGER_SERVICENAME = "MyApp"
$env:PSLOGGER_SERVICEVERSION = "1.2.3"
$env:PSLOGGER_ENVIRONMENT = "production"
Import-Module ./PsLogger.psm1
# Write a log file
Write-Logger -Message "something happened" -Level 9 -LogFilePath ./out.log
# pipe from New-Logger
New-Logger -Message "test" -Level 13 | Write-Logger -LogFilePath ./out.log
podman compose up -d
# localhost:3000