Skip to content

Out-Log

SYNOPSIS

Outputs log messages to a file and optionally to the host.

SYNTAX

Out-Log [[-Log] <Object>] [[-Label] <Object>] [[-Text] <Object>] [[-OutHost] <Object>] [-InvokeThrow]

DESCRIPTION

This function writes log messages to a file in the specified log directory. It also supports: - Creating a separate error log file for entries labeled as errors. - Outputting log messages to the host if specified. - Throwing exceptions for critical log entries.

EXAMPLES

Example 1

PS C:\> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-Log

The log object created by `New-Log`. Contains log configuration details.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Label

A label for the log entry, e.g., "INFO", "ERROR".

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Text

The text of the log entry.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-OutHost

A boolean indicating whether the log message should be output to the host. Overrides the `OutHost` value in the log object.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-InvokeThrow

A switch indicating whether to throw an exception with the log message.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES