< Back

Get-PSFMessage

Sun Jan 19, 2020 6:40 pm

NAME Get-PSFMessage



SYNOPSIS

Returns log entries for the PSFramework





SYNTAX

Get-PSFMessage [[-FunctionName] <String>] [[-ModuleName] <String>] [[-Target] <Object>] [[-Tag] <String[]>]

[[-Last] <Int32>] [[-Skip] <Int32>] [[-Runspace] <Guid>] [[-Level] {Critical | Important | Output | Host |

Significant | VeryVerbose | Verbose | SomewhatVerbose | System | Debug | InternalComment | Warning}] [-Errors]

[<CommonParameters>]





DESCRIPTION

Returns log entries for the PSFramework. Handy when debugging or developing a script using it.





PARAMETERS

-FunctionName <String>

Default: "*"

Only messages written by similar functions will be returned.



Required? false

Position? 1

Default value *

Accept pipeline input? false

Accept wildcard characters? false



-ModuleName <String>

Default: "*"

Only messages written by commands from similar modules will be returned.



Required? false

Position? 2

Default value *

Accept pipeline input? false

Accept wildcard characters? false



-Target <Object>

Only messages handling the specified target will be returned.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tag <String[]>

Only messages containing one of these tags will be returned.



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Last <Int32>

Only messages written by the last X executions will be returned.

Uses Get-History to determine execution. Ignores Get-PSFmessage commands.

By default, this will also include messages from other runspaces. If your command executes in parallel, that's

useful.

If it doesn't and you were offloading executions to other runspaces, consider also filtering by runspace using

'-Runspace'



Required? false

Position? 5

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Skip <Int32>

How many executions to skip when specifying '-Last'.

Has no effect without the '-Last' parameter.



Required? false

Position? 6

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Runspace <Guid>

The guid of the runspace to return messages from.

By default, messages from all runspaces are returned.

Run the following line to see the list of guids:



Get-Runspace | ft Id, Name, InstanceId -Autosize



Required? false

Position? 7

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Level

Limit the message selection by level.

Message levels have a numeric value, making it easier to select a range:



-Level (1..6)



Will select the first 6 levels (Critical - SomewhatVerbose).



Required? false

Position? 8

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Errors [<SwitchParameter>]

Instead of log entries, the error entries will be retrieved



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-PSFMessage



Returns all log entries currently in memory.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-PSFMessage -Target "a" -Last 1 -Skip 1



Returns all log entries that targeted the object "a" in the second last execution sent.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-PSFMessage -Tag "fail" -Last 5



Returns all log entries within the last 5 executions that contained the tag "fail"











RELATED LINKS