You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
572 B
22 lines
572 B
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace BlazorApp1.Pages
|
|
{
|
|
public partial class CreateLog
|
|
{
|
|
[Inject]
|
|
public ILogger<CreateLog> Logger { get; set; }
|
|
|
|
private void CreateLogs()
|
|
{
|
|
var logLevels = Enum.GetValues(typeof(LogLevel)).Cast<LogLevel>();
|
|
|
|
foreach (var logLevel in logLevels.Where(l => l != LogLevel.None))
|
|
{
|
|
Logger.Log(logLevel, $"Log message for the level: {logLevel}");
|
|
}
|
|
}
|
|
}
|
|
}
|