Skip to content

tsukiy0's blog

Custom JSON Layout Renderer for NLog

May 29, 2021

If you have a standard log format to adhere to, it can be a bit fiddly to produce the desired result with the existing layout renderers.

Instead, we can write our own layout renderer that simply maps the NLog LogEventInfo to our own log class and stringify that with System.Text.Json.

Log format

LayoutRenderer

Usage


tsukiy0