Skip to content

Instantly share code, notes, and snippets.

View liamkernighan's full-sized avatar
🎯
Focusing

liamkernighan

🎯
Focusing
View GitHub Profile
@liamkernighan
liamkernighan / logger.ps1
Created October 23, 2024 10:27 — forked from barsv/logger.ps1
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line