English 中文(简体)
• 在Serilog确定最低等级:是否可以为名称空间使用野心/reg?
原标题:Setting the MinimumLevel in Serilog: is it possible to use a wildcard/regex for the namespace?

• 在Serilog确定最低等级:是否可以使用野心/管理名称空间?

让我们假设,我有自己的名称空间,有不同的搭桥,这既需要放在信息上。

  • MyNameSpace
  • MYNameSpace

可以通过组合这样做吗?

"SeriLog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Default": "Warning",
        "MyNameSpace|MYNameSpace": "Information"
      }
    }
  }

或者,只有具体说明这两种情况才能做到这一点?

"SeriLog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Default": "Warning",
        "MyNameSpace": "Information",
        "MYNameSpace": "Information"
      }
    }
  }
最佳回答

最低等级的特征是而不是支持这份书面文件中的野心/reg。 它只支持简单的(对个案敏感的)部分配对:中发挥作用。

宣布两个不同的名称空间是你的第二个例子。

问题回答

You can also exclude some log entries using Serilog.Expressions https://github.com/serilog/serilog/issues/1786#issuecomment-1487933383

I.e. 为<代码>System.Net.Http.HttpClient设定了最低水平,以便通过信息获取信息,但使用<代码>Filter.ByExcluding(......),例如排除<代码>的表述。 资料来源:统计局。 系统.Net.Http.HttpClient.%. CarloicalHandler 。





相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...

热门标签