Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 440 Bytes

monitoring.md

File metadata and controls

26 lines (22 loc) · 440 Bytes

Monitoring

When to write a log

If is a branch that stops the normal flow code then log a warning

Before:

if (entity == null)
{
    return null;
}

After:

if (entity == null)
{
    _logger.LogWarning("Entity with id {Id} is not found", id)
    return null;
}

If is a normal branch and there is a remarkable event then log a information:

_logger.LogInformation("An entity has been created")