Copyl Microservice Management offers a centralized logging feature that makes it so much easier to be a developer debugging one or more microservices.
ILogger
into your controller / codetry{} catch{}
to register errors to Copyl Microservice logging.public class UsersController : ControllerBase
{
private readonly ILogger<UsersController> _logger;
public UsersController(ILogger<UsersController> logger)
{
_logger = logger;
}
[HttpPost]
public async Task<ActionResult<User>> PostUser(User user)
{
try
{
**_logger.LogInformation**("Processing request");
**_logger.LogWarning**("This is a warning and will be orange in the Copyl logging window.");
...
}
catch (Exception err)
{
**_logger.LogError**(err, "Error in {method}", MethodBase.GetCurrentMethod().Name);
throw;
}
}
}