test/11.log_keep_data.ps1

<#
 
If handlers are added to the logger at initialization time,
no console handler is created, because we suppose that we need total control
over the handlers.
 
to create a default console handler, initiliaze first the logger, then add
some handlers.
 
We can also create the logger with -NoDefaultHandler parameter to remove the default
console handler.
 
#>



Write-Host "EXAMPLE 11"

Import-Module ..\uLog.psd1 -Force

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

Write-Host "EXAMPLE 11.1"

$evt = New-uLogEventLog -Name 'evt'
$log = New-uLog -Handler $evt -NoHeader

Log-Trace       -Message "Trace Hello"
$evt.Keep = $true

Log-Verbose     -Message "Verbose Hello"
Log-Debug       -Message "Debug Hello"
Log-Success     -Message 'YES !'
Log-Info        -Message 'Hello' 
Log-Information -Message 'Hello' 

$evt.Flush()

Log-Warning     -Message 'Watch out'
Log-Warn        -Message 'Watch out'
Log-Error       -Message 'Problem'
Log-Critical    -Message 'Failure'
Log-Fatal       -Message 'Fatal error'