使用 Serilog 同时记录到 AzureTableStorage

logging with Serilog Concurrently to AzureTableStorage

与登录到文件相比,登录到 AzureTableStorage 会导致阻塞下一次调用的开销,有没有办法加快此过程(批处理或异步选项)?

我的代码在appsetttings.josn:

"Serilog": {
    "MinimumLevel": "Information",
    "WriteTo": [
      {
        "Name": "AzureTableStorage",
        "Args": {
          "storageTableName": "tbl",
          "connectionString": "DefaultEndpointsProtocol=http;AccountName=xxx;AccountKey=/xxxxxxxx"
        }
      }
    ]
  }

我最终使用了 https://github.com/serilog/serilog-sinks-async 和 AzureTableStorage 中的批处理选项,类似于:

"WriteTo": [
            {
                "Name": "Async",
                "Args": {
                    "configure": [
                        {
                            "Name": "AzureTableStorage",
                            "Args": {
                                "storageTableName": "tbl",
                                "connectionString": "DefaultEndpointsProtocol=http;AccountName=xxx;AccountKey=xxx"
                            }
                        }
                    ]
                }
            }
        ]