Skip to content

Logging

Stanislav Molchanovskiy edited this page Jul 17, 2022 · 7 revisions

To log information about the execution of the request, the status of responses and errors, you can set a logger or logger factory for a client:

ILogger<IMyClient> logger = ...;

IMyClient client = NClientGallery.Clients.GetRest()
    .For<IMyClient>(host: "http://localhost:8080")
    .WithLogging(logger)
    .Build();

⚠️ NClient uses structured logging, so use a logger that supports structured logging and scopes to get complete information in the logs.

Clone this wiki locally