functions/debugging/Enable-SelfLog.ps1

1
2
3
4
5
6
7
8
9
10
11
12
function Enable-SelfLog {
    param(
        [Parameter(Mandatory = $false)]
        [System.Action[string]]$MessageFunc
    )

    if ($null -eq $MessageFunc) {
        $MessageFunc = { param([string]$msg) Write-Warning $msg }
    }

    [Serilog.Debugging.SelfLog]::Enable($MessageFunc)
}