saleem-mirza / serilog-enrichers-context

Enriches Serilog events with information from the environment variables or user provided custom property.
Apache License 2.0
5 stars 2 forks source link

Provide overload to give Environment Variable log event property a different name to the Environment Variable #6

Closed edwardaskew closed 6 years ago

edwardaskew commented 6 years ago

I would like to add some ASPNETCORE_* environment variable values to my log entries but under nicer names (e.g. I'd like to use Environment rather than ASPNETCORE_ENVIRONMENT).

Would it be possible to add an optional parameter to WithEnvironment (and the EnvironmentEnricher constructor) to take the name of the resulting property defaulting to the raw environment variable name?

saleem-mirza commented 6 years ago

@edwardaskew, thank you very much for suggesting improvement. However, in my humble opinion, a library should not change state of information. It's application responsibility to pre-process information and library should simply take it as face value.

This library has an overload which accepts key/value pair which I believe is closely matching what you are intending to do.