test/07.with_Levels.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Import-Module ..\uLog.psd1 -Force

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

$log = New-uLog

$local = New-uLogFile -Name local
$log.AddLogHandler($local)

$temp = New-uLogFile -Name temp -Path c:\temp\test7_with_Levels.ps1.log

$log.AddLogHandler($temp)

$evt = New-uLogEventLog 
$log.AddLogHandler($evt)



#$log.local.Formatter = Format-FileNoIndent

Log-Info -Message 'Hello' -Exclude $evt, $temp, ($log.Handlers | ? Name -EQ Console)
Log-Warning -Message 'Attention' -Indent 3 -NoDisplayOnTerminal
Log-Info -Message 'Hello'
Log-Success 'YES !'
Log-Error 'Problem'
Log-Critical 'Failure'
Write-Log -Message 'Youpi' -Level SUCCESS
#>

$log.Handlers

Remove-Variable -Name uLOG -ErrorAction SilentlyContinue
    $log = New-uLog 
function test-log1
{
    
    
    Log-Info -Message 'Hello'
    Log-Warning -Message 'Attention' -Indent 3
    Log-Info -Message 'Hello'
    Write-Log -Message 'Youpi' -Level SUCCESS
}