PoShLog.Enrichers is extension module for PoShLog logging module. Contains lot of helpful enricher methods, useful when enriching log messages with more properties.
If you are familiar with PowerShell, skip to Installation section. For more detailed installation instructions check out Getting started wiki.
To install PoShLog.Enrichers, run following snippet from powershell:
Install-Module -Name PoShLog.Enrichers
Import-Module PoShLog
Import-Module PoShLog.Enrichers
New-Logger |
Add-EnrichWithEnvironment |
Add-EnrichWithExceptionDetails |
Add-SinkConsole -OutputTemplate "[{MachineName} {Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}" |
Start-Logger
Write-InfoLog 'Hurrray, my first log message!'
# Don't forget to close the logger
Close-Logger
Outputs(Notice the machine name added automatically):
[DESKTOP-PQ6409S 11:16:20 INF] Hurrray, my first log message!
- Add-EnrichWithEnvironment - Adds
MachineName
andEnvironmentUserName
properties to log events - Add-EnrichWithExceptionDetails - Adds additional structured properties from exceptions into log events
- Add-EnrichWithProcessId - Enriches log events with current
ProcessId
property - Add-EnrichWithProcessName - Enriches log events with current
ProcessName
property
These examples are just to get you started fast. For more detailed documentation please check wiki.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Icon made by Smashicons from www.flaticon.com.