Skip to content

Instantly share code, notes, and snippets.

@alexandrebl
Created September 2, 2021 12:23
Show Gist options
  • Select an option

  • Save alexandrebl/35d87ffd84e7bed6b4639b0335230c28 to your computer and use it in GitHub Desktop.

Select an option

Save alexandrebl/35d87ffd84e7bed6b4639b0335230c28 to your computer and use it in GitHub Desktop.
Microsoft Logger Console Load Service
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
class Program
{
static Task Main(string[] args)
{
IHost host = Host.CreateDefaultBuilder(args).Build();
var logger = host.Services.GetRequiredService<ILogger<Program>>();
logger.LogInformation("Host created.");
return host.RunAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment