test/12.log_Include.ps1

<#
 
test Include functionnality
only writes log to handlers specified by -Include
 
#>



Write-Host "EXAMPLE 12"

Import-Module ..\uLog.psd1 -Force

Remove-Variable -Name uLOG -ErrorAction SilentlyContinue
Remove-Variable -Name Log -ErrorAction SilentlyContinue

$log = New-uLog -NoHeader
$log.AddLogHandler( (New-uLogFile -Name Temp2 -Path "$($env:TEMP)\Example12_log2.log" ))
$log.AddLogHandler( (New-uLogFile -Name Temp3 -Path "$($env:TEMP)\Example12_log3.log" ))


Log-Info -Message 'Write to all logs'
Log-Info -Message 'Write only to log2' -Include $log.Handlers.Temp2