Skip to content

Instantly share code, notes, and snippets.

@mntlfngrs
mntlfngrs / logger.ps1
Last active March 3, 2021 19:04 — forked from barsv/logger.ps1
Logging in powershell with leading "0" numbered files that retain file extension and log rotation
# all logging settins are here on top
param(
[Parameter(Mandatory=$false)]
[string]$logFile = "$(gc env:computername).log",
[Parameter(Mandatory=$false)]
[string]$logLevel = "DEBUG", # ("DEBUG","INFO","WARN","ERROR","FATAL")
[Parameter(Mandatory=$false)]
[int64]$logSize = 10mb,
[Parameter(Mandatory=$false)]
[int]$logCount = 25