Add EnrichWithProcessId - PoShLog/PoShLog GitHub Wiki
Dependencies
This cmdlet requires extension module PoShLog.Enrichers to be installed.
Install-Module PoShLog.Enrichers
Add-EnrichWithProcessId 
Enriches log events with current process id
Add-EnrichWithProcessId
[-LoggerConfig] <LoggerConfiguration>
[<CommonParameters>]
Description
This cmdlet will automatically add current process name(ProcessId) into log event properties. You can view this property by adding it to sink's -OutputTemplate or by adding {Properties:j} to sink's -OutputTemplate. You can also view all properties in many cloud sinks(Seq, Exceptionless, ...).
Examples
Example 1: Show process id in console
Notice {ProcessId} property added to OutputTemplate.
New-Logger |
Add-EnrichWithProcessId |
Add-SinkConsole -OutputTemplate '[{Timestamp:HH:mm:ss} {ProcessId} {Level:u3}] {Message:lj}{NewLine}{Exception}{ErrorRecord}' |
Start-Logger
Parameters
-LoggerConfig
Instance of LoggerConfiguration
| Type: | LoggerConfiguration |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True (ByValue) |
| Accept wildcard characters: | False |