Framework/Listeners/ListenerHelper.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
45
46
47
48
49
Set-StrictMode -Version Latest
#Class to register appropriate listeners based on environment
class ListenerHelper
{
    static ListenerHelper()
    {
    }

    static [void] RegisterListeners()
    {
        [WriteFolderPath]::GetInstance().RegisterEvents();
        [WriteDetailedLog]::GetInstance().RegisterEvents();
        [WriteSummaryFile]::GetInstance().RegisterEvents();
        [WritePsConsole]::GetInstance().RegisterEvents();
        [WriteDataFile]::GetInstance().RegisterEvents();
        [LogAnalyticsOutput]::GetInstance().RegisterEvents();
        [EventHubOutput]::GetInstance().RegisterEvents();
        [WebhookOutput]::GetInstance().RegisterEvents();
        [AIOrgTelemetry]::GetInstance().RegisterEvents();
        [UsageTelemetry]::GetInstance().RegisterEvents();
        [RemoteReportsListener]::GetInstance().RegisterEvents();
        [WriteEnvironmentFile]::GetInstance().RegisterEvents();
        [WriteFixControlFiles]::GetInstance().RegisterEvents();
        [SecurityRecommendationReport]::GetInstance().RegisterEvents();
        [GenericListener]::GetInstance().RegisterEvents();        
    }


    static [void] UnregisterListeners()
    {
        [WriteFolderPath]::GetInstance().UnregisterEvents();
        [WriteDetailedLog]::GetInstance().UnregisterEvents();
        [WriteSummaryFile]::GetInstance().UnregisterEvents();
        [WritePsConsole]::GetInstance().UnregisterEvents();
        [WriteDataFile]::GetInstance().UnregisterEvents();
        [LogAnalyticsOutput]::GetInstance().UnregisterEvents();
        [EventHubOutput]::GetInstance().UnregisterEvents();
        [WebhookOutput]::GetInstance().UnregisterEvents();
        [AIOrgTelemetry]::GetInstance().UnregisterEvents();
        [UsageTelemetry]::GetInstance().UnregisterEvents();
        [RemoteReportsListener]::GetInstance().UnregisterEvents();
        [WriteEnvironmentFile]::GetInstance().UnregisterEvents();
        [WriteFixControlFiles]::GetInstance().UnregisterEvents();
        [SecurityRecommendationReport]::GetInstance().UnregisterEvents();
        [GenericListener]::GetInstance().UnregisterEvents();        
    }    
}
#[ListenerHelper]::RegisterListeners();