~ruther/NosSmooth

ref: 24c8d2cc70193b8d82a830337060e0aba50f6867 NosSmooth/Samples/testapp/Program.cs -rw-r--r-- 818 bytes
24c8d2cc — František Boháček chore: add stylecop, ensure stylecop rules are met 3 years ago
                                                                                
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
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Threading;

namespace testapp
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var provider = new ServiceCollection()
                .AddLogging(b =>
                {
                    b.ClearProviders();
                    b.AddConsole();
                    b.SetMinimumLevel(LogLevel.Debug);
                })
                .BuildServiceProvider();
            Console.WriteLine("Test");
            var logger = provider.GetRequiredService<ILogger<Program>>();
            Console.WriteLine("Hell");
            logger.LogError("Built services");
            Console.WriteLine("Hello World!");
            Thread.Sleep(1000);
        }
    }
}
Do not follow this link