Nest 2.0 enable trace

前端 未结 1 1086
离开以前
离开以前 2020-12-29 16:01

I am on updating to the latest Nest version. Since I am getting not the expected results I am searching for replacement of the EnableTrace() method

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 16:17

    EnableTrace() will be back, but it's not available yet(have a look).

    For now you can use this code to print out information about request and response:

    var settings = new ConnectionSettings(connectionPool)
        .DefaultIndex(indexName)
        .DisableDirectStreaming()
        .OnRequestCompleted(details =>
        {
            Debug.WriteLine("### ES REQEUST ###");
            if(details.RequestBodyInBytes != null) Debug.WriteLine(Encoding.UTF8.GetString(details.RequestBodyInBytes));
            Debug.WriteLine("### ES RESPONSE ###");
            if (details.ResponseBodyInBytes != null) Debug.WriteLine(Encoding.UTF8.GetString(details.ResponseBodyInBytes)); 
        })
        .PrettyJson();
    

    Make sure you have set .DisableDirectStreaming() on ConnectionSettings.

    Hope it helps.

    0 讨论(0)
提交回复
热议问题