test/06.module.psm1



Import-Module ..\uLog.psd1 -WarningAction SilentlyContinue

Remove-Variable -Name uLOG -ErrorAction SilentlyContinue

<#
.DESCRIPTION
This module tests how to write a log from a function in a module.
 
In this case, no log object is set in the first place, we expect the uLog
to manage the best way to use the log.
 
As so, the log is write in the eventlog.
 
#>

function Test-Log
{

    $log = New-uLog 

    $LOGPATH = "$($env:temp)\TestuLog_$(Get-Date -Format 'yyyy.MM.dd-hh.mm.ss').log"

    $log.AddLogHandler( (New-uLogFile -Path $LOGPATH `
                                          -Append:$true) )
    
    
    Log-Info    -Message 'Hello from module'
    Log-Warning -Message 'Watch out ! from module' -Indent 3
    Log-Info    -Message 'Hello from module'


}