Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Implement Push-LogContextProp cmdlet #34

Open
cdhunt opened this issue Nov 4, 2022 · 1 comment
Open

[Feature Request] Implement Push-LogContextProp cmdlet #34

cdhunt opened this issue Nov 4, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@cdhunt
Copy link

cdhunt commented Nov 4, 2022

I don't see this cmdlet defined anywhere.

I assume it's a helper for [Serilog.Context.LogContext]::PushProperty(string name, System.Object value, bool destructureObjects).

Enriches log events with properties from LogContext. Use Push-LogContextProp to add properties.

@TomasBouda TomasBouda added the enhancement New feature or request label Nov 6, 2022
@efrecon
Copy link

efrecon commented Aug 29, 2023

Until this has been implemented, a workaround is to create a thin wrapper around the Write-*Log functions that will push the property, call the Write-XXXLog function and then call Dispose(). As in the pseudo-code below:

$disposable = [Serilog.Context.LogContext]::PushProperty('MyProp', "some autocomputed value")
# Call Write-xxxLog
$disposable.Dispose()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants