Skip to content

open-coding/PSColorizedLogOutput

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A PowerShell module to write colorized log-output to host

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published