New-ConsoleLogRegion
Creates a log region: the newest lines of a log, bottom-aligned.
Syntax
New-ConsoleLogRegion
[-Capacity <Int32>]
[[-Content] <ScriptBlock>]
[-Height <Int32>]
[-InputObject <PSObject>]
[-LevelColumn <ColumnFormat>]
[-NoElapsed]
[[-WidgetId] <String>]
[-Wrap]
[<CommonParameters>]#All Parameter SetsDescription
Printed once, the lines come from a script block of New-ConsoleLogEntry calls (each with a level and a time) or from the pipeline. In a live dashboard the log region receives Write-Host, Write-Information, Write-Warning, Write-Verbose and error output from the runspaces Invoke-ConsoleDashboard owns, plus Console.WriteLine from .NET code, so nothing scribbles over the screen; write to it explicitly with Write-ConsoleLogEntry. To add lines to a log made earlier, pipe it to Add-ConsoleItem.
Examples
Example 1
New-ConsoleLogRegion -Height 5 -Content {
New-ConsoleLogEntry 'Discovered 4 domain controllers in 2 domains' -Level Info -AtSeconds 2
New-ConsoleLogEntry 'DC02: USN rollback check failed (event 2095)' -Level Error -AtSeconds 44
New-ConsoleLogEntry 'Using cached schema snapshot' -Level Verbose -AtSeconds 53
} | Show-ConsoleA short log printed once
Example 2
New-ConsolePanel -Title 'Log' -Fill -Content { New-ConsoleLogRegion }A log that fills the rest of a dashboard
Parameters
- -Capacity Int32
- Lines kept in memory (default 1000).
- -Content ScriptBlock
- A script block that emits the lines: New-ConsoleLogEntry calls, or strings for info lines.
- -Height Int32
- Rows requested when printed once (default 8).
- -InputObject PSObject
- Lines from the pipeline: New-ConsoleLogEntry objects or strings.
- -LevelColumn ColumnFormat
- Shared LevelColumn layout settings from New-ConsoleColumnFormat.
- -NoElapsed SwitchParameter
- Hide the time at the start of each line.
- -WidgetId String
- The live widget identifier (default log).
- -Wrap SwitchParameter
- Wrap long lines (up to three rows each) instead of cutting them.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.