Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.63 KB

README.md

File metadata and controls

30 lines (20 loc) · 1.63 KB

PSColorizedLogOutput

A PowerShell module for colorized log output

This PowerShell module provides the cmdlet Write-HostWithColorizedLogLevels that colorizes e.g. the output of a logfile according the several loglevels. It can easily be combined with PSGetWebContent. It reads a string and writes it to host with the color of the detected LogLevel as the foreground color. All the AlternativeNames of a LogLevel will be used to analyse a line.

Installation

Simply download the whole PSColorizedLogOutput folder to C:\Users\<username>\Documents\WindowsPowerShell\Modules\

Syntax

Write-HostWithColorizedLogLevels [[-Line] <String[]>] [[-ShowOnly] <String[]>] [<CommonParameters>]

Parameters

-Line <String[]>
    Specifies the line that should be written to host with the specific foreground color of the detected LogLevel

-ShowOnly <String[]>
    Specifies the severity of the loglevel that should be passed through the filter

Examples

Example 1

PS C:\>Get-Content C:\wildfly-10.1.0.Final\standalone\log\server.log | Write-HostWithColorizedLogLevels

Example 2 - you can also tail the logfile and pipe it to this function

PS C:\>Get-Content C:\wildfly-10.1.0.Final\standalone\log\server.log -Tail 10 -Wait | Write-HostWithColorizedLogLevels

Example 3 - you want only see parts of the logfile that represents specific loglevel?

#In this example only the LogLevels WARN and ERROR are written to host. Other Levels will not be shown

Get-Content C:\wildfly-10.1.0.Final\standalone\log\server.log | Write-HostWithColorizedLogLevels -ShowOnly WARN, ERROR