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.
Simply download the whole PSColorizedLogOutput
folder to C:\Users\<username>\Documents\WindowsPowerShell\Modules\
Write-HostWithColorizedLogLevels [[-Line] <String[]>] [[-ShowOnly] <String[]>] [<CommonParameters>]
-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
PS C:\>Get-Content C:\wildfly-10.1.0.Final\standalone\log\server.log | Write-HostWithColorizedLogLevels
PS C:\>Get-Content C:\wildfly-10.1.0.Final\standalone\log\server.log -Tail 10 -Wait | Write-HostWithColorizedLogLevels
#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