小编use*_*804的帖子

NLog:使用空格格式化日志级别

我正在使用NLog进行日志记录.目前我的Layout-String是:

"${date:format=dd.MM.yyyy HH\\:mm\\:ss,fff} | ${level:uppercase=true} | ${message}"
Run Code Online (Sandbox Code Playgroud)

这会产生以下日志:

18.12.2013 11:23:14,834 | INFO | this is an info
18.12.2013 11:23:14,835 | TRACE | this is a trace
Run Code Online (Sandbox Code Playgroud)

我现在想要的是格式化"$ level"以填充Whitespaces,使其看起来像一个包含5个字符的表.

我想拥有:

18.12.2013 11:23:14,834 | INFO  | this is an info
18.12.2013 11:23:14,835 | TRACE | this is a trace
Run Code Online (Sandbox Code Playgroud)

我没有发现任何遗憾......任何人都可以帮忙吗?

format whitespace nlog

14
推荐指数
2
解决办法
4798
查看次数

标签 统计

format ×1

nlog ×1

whitespace ×1