Logging

out

Overview

Provides an alternative to the native "Write-*" cmdlets, allowing us to write directly to out and error streams, rather than the console host.

Cmdlet Attributes

Copy
Copied
CmdletBinding : []
Alias         : ['error', 'debug', 'verbose', 'info', 'warning']

Parameters

Message

The message to send to the specified pipeline.

Attributes

Copy
Copied
Parameter        : [Mandatory, ValueFromPipeline, Position = 0]
AllowNull        : []
AllowEmptyString : []

NoPrepend : System.Management.Automation.SwitchParameter

If the -NoPrepend switch is provided and a non-default function alias ( ex: warning, verbose, error ) is invoked, the output will not be prepended with the alias name. As an example, if this function were invoked with the verbose alias without the -NoPrepend switch, the resultant output would look like: VERBOSE: Test Message.

Attributes

Copy
Copied
Parameter : []

Example

Copy
Copied
# the out alias, using positional parameters 
PS> out 'one' 'two' 'three' 
one 
two 
three 
# the verbose alias, using pipeline input 
PS> 'one', 'two', 'three' | verbose 
VERBOSE: one 
VERBOSE: two 
VERBOSE: three 

History

Author Date Version Release Notes
Anthony Maxwell 08/24/2023 1.0.0 - Initial release.
Anthony Maxwell 09/06/2023 1.1.0 - Input type change from System.String[] to System.String
- Removed erroneous output in InvocationName switch in process block
- Message null check
- Implemented AllowNull() and AllowEmptyString() parameter attributes for Message parameter
Anthony Maxwell 09/14/2023 1.1.1 - Documentation pass.