functions/message/Get-PSFMessageLevelModifier.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
function Get-PSFMessageLevelModifier
{
<#
 .SYNOPSIS
  Returns all registered message level modifiers with similar name.
  
 .DESCRIPTION
  Returns all registered message level modifiers with similar name.
  
  Message level modifiers are created using New-PSFMessageLevelModifier and allow dynamically modifying the actual message level written by commands.
  
 .PARAMETER Name
  Default: "*"
  A name filter - only commands that are similar to the filter will be returned.
  
 .EXAMPLE
  PS C:\> Get-PSFMessageLevelModifier
  
  Returns all message level filters
  
 .EXAMPLE
  PS C:\> Get-PSFmessageLevelModifier -Name "mymodule.*"
  
  Returns all message level filters that start with "mymodule."
#>

    [CmdletBinding()]
    Param (
        [string]
        $Name = "*"
    )
    
    ([PSFramework.Message.MessageHost]::MessageLevelModifiers.Values) | Where-Object Name -Like $Name
}