Public/Log/LogConfiguration.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
if (-not ('LogLevel' -as [System.Type])) {
    $logLevelDef = "
    public enum LogLevel : int
    {
        Debug=0,
        Info,
        Warn,
        Error
    }
    "


    Add-Type -TypeDefinition $logLevelDef
}


$Script:LogConfiguration = [PSCustomObject]@{
    # Logging level threshold - available values: DEBUG, INFO, WARN, ERROR
    LogLevel = [LogLevel]::Info;

    # Path to file log or $null if shouldn't log to file.
    LogFile = $null;

    # Name of Event Log Source to log to or $null if shouldn't log to Event Log.
    LogEventLogSource = $null;         

    # Logging level threshold for Event Log - available values: DEBUG, INFO, WARN, ERROR.
    # This would normally have higher threshold than LogLevel.
    LogEventLogThreshold = [LogLevel]::ERROR; 
}