Closed suntereo closed 1 year ago
This is great! Thank you very much. I'll run the code, document the new option in the Readme, merge the PR and publish a new version of the package within the day.
Thank you!
Sorry for the delay again.
I've the new feature in the template projet. It works well.
Though it fails if the last parameter is a simple type such as a string. I'll try to warn users of this case in the readme. Thank you!
Enhancement of Loki Fields Rendering with sendLastFormatParameter and Custom Fields from Properties
This pull request introduces two significant features that align NLog.Loki with the behavior observed in NLog.Web.AspNetCore.Targets.Gelf:
Implementation of the
sendLastFormatParameter
option: This feature enables the last parameter of a log message format to be sent to Loki as separate fields per property.Example:
Reading custom fields from event properties: Like Gelf target, this feature reads custom fields from the log event properties.
Example:
These enhancements significantly streamline the migration process from Graylog to Loki. Prior to this update, programmers faced a time-consuming and error-prone task of identifying and modifying many lines of code that attempted to pass additional data. The difficulty of this process increased the risk that some data might be lost without notice, as the previous implementation didn't throw an error for such occurrences. This update alleviates these concerns, making the transition smoother and more reliable.