首页 > 解决方案 > NLog:缩进消息

问题描述

示例:方法 A 调用方法 B,B 调用 C,所有方法都将消息写入日志。是否可以像这样使用 NLog 自动缩进消息?

String in method A before B is called
    First string in method B
    Second string in method B and call C
        First string in method C
        Second string in method C
    Third string in method B after C is called
String in method A after B is called

也许有一些API来指定当前缩进级别,所以所有后续输出到日志都将使用这个级别?

标签: c#nlog

解决方案


推荐阅读