-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyClass.cs
34 lines (29 loc) · 963 Bytes
/
MyClass.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
namespace aspnet_logging_05_cli
{
using Microsoft.Extensions.Logging;
public class MyClass
{
private readonly ILogger<MyClass> _logger;
public MyClass(ILogger<MyClass> logger)
{
_logger = logger;
}
public void DoSomething(int input)
{
_logger.LogDebug("Starting to do something with input: {0}", input);
if (input >= -1 && input <= 1)
{
_logger.LogInformation("Input of {0} is within the optimal range.", input);
}
else if (input > 10)
{
_logger.LogWarning("Input of {0} is greater than the typical range.", input);
}
else if (input < -10)
{
_logger.LogError("Input of {0} is less than the typical range.", input);
}
_logger.LogDebug("Finished doing something with input: {0}", input);
}
}
}