Skip to content
ConsoleMonster
Cmdlet

New-ConsoleLogRegion

Module
ConsoleMonster
Inputs
System.Management.Automation.PSObject
Outputs
ConsoleMonster.Widgets.LogRegion

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>]
#
Parameter set: All Parameter Sets

Description

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-Console

A 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 optional
Lines kept in memory (default 1000).
-Content ScriptBlock optionalposition: 1
A script block that emits the lines: New-ConsoleLogEntry calls, or strings for info lines.
-Height Int32 optional
Rows requested when printed once (default 8).
-InputObject PSObject optionalpipeline: True (ByValue)
Lines from the pipeline: New-ConsoleLogEntry objects or strings.
-LevelColumn ColumnFormat optional
Shared LevelColumn layout settings from New-ConsoleColumnFormat.
-NoElapsed SwitchParameter optional
Hide the time at the start of each line.
-WidgetId String optionalposition: 0
The live widget identifier (default log).
-Wrap SwitchParameter optional
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.