PoShLog.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Indicates wether warning about logger is not initialized was shown
[bool] $Global:loggerNotInitWarned = $false

# Load all package dlls
. "$PSScriptRoot\functions\internal\Add-PackageTypes.ps1"
Add-PackageTypes -LibsDirectory "$PSScriptRoot\lib"

# dot source all script files
Get-ChildItem -Path "$PSScriptRoot\functions" -Recurse -File -Filter '*.ps1' | ForEach-Object {
    . $_.FullName

    # Export all functions except internal
    if ($_.FullName -notlike '*\internal\*') {
        Export-ModuleMember $_.BaseName
    }
}

# Default text formatter for Get-FormattedMessage cmdlet
$global:TextFormatter = [Serilog.Formatting.Display.MessageTemplateTextFormatter]::new('{Message:lj}')