formatters/ccmtrace.psm1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
function Format-ccmtrace { param( $Record ) switch ($Record.Level){ "DEBUG" {$level = 1;break} "INFO" {$level = 1;break} "INFORMATION" {$level = 1;break} "SUCCESS" {$level = 1;break} "TRACE" {$level = 1;break} "VErBOSE" {$level = 1;break} "WARNING" {$level = 2;break} "WARN" {$level = 2;break} "ERROR" {$level = 3;break} "FATAL" {$level = 3;break} "CRITICAL" {$level = 3;break} default {$level = 1} } return "<![LOG[{6} {0}]LOG]!><time=`"{1}`" date=`"{2}`" component=`"{3}`" context=`"`" type=`"{5}`" thread=`"`" file=`"{4}`">" ` -f ( ("{0}{1}" -f ("`t"*($Record.Indent - 1)), $Record.Message), (Get-Date -Format "HH:mm:ss.fffzz"), (Get-Date -Format "MM-dd-yyyy"), $Record.Source, (Get-Item $Record.Source).BaseName, $level, $Record.Level ) } <# CCM or SCCM log file format is the following on each line: <![LOG[<MESSAGE>]LOG]!><time="TIME" date="DATE" component="COMPONENT_NAME" context="" type="1" thread="" file="FILE_NAME"> MESSAGE = $Record.Message TIME = DATE = COMPONENT_NAME = $Record.Source FILE_NAME = $Record.Message for example <![LOG[Property LogPath is now = X:\MININT\SMSOSD\OSDLOGS]LOG]!><time="17:52:00.000+000" date="12-01-2016" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> #> |