-
Notifications
You must be signed in to change notification settings - Fork 31
/
Index.razor
31 lines (26 loc) · 1006 Bytes
/
Index.razor
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
@page "/"
@inject HttpClient Http
@inject ILogger<Index> logger
<h1>Logging Test, Open up your browser devtools to see the logs!</h1>
@functions {
WeatherForecast[] forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("weather.json");
logger.LogTrace("Trace: Forecast");
logger.LogDebug("Debug: Forecast");
logger.LogWarning("Warning: Forecast");
logger.LogError("Error: Forecast");
logger.LogCritical("Critical: Forecast");
logger.LogError(new Exception("Oh my, exception"), "Error: Forecast");
logger.LogInformation(forecasts);
logger.LogInformation(forecasts[0]);
}
class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public string Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}