-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (34 loc) · 1.28 KB
/
Program.cs
File metadata and controls
36 lines (34 loc) · 1.28 KB
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
35
36
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Logging.EventLog;
using System.Threading.Tasks;
namespace HyperWindowsService
{
class Program
{
static async Task Main(string[] args)
{
await Host.CreateDefaultBuilder(args)
.ConfigureLogging(configureLogging => configureLogging.AddFilter<EventLogLoggerProvider>(level => level >= LogLevel.Information))
.ConfigureServices((hostContext, services) =>
{
services.AddLogging((builder) =>
{
builder.AddConsole();
});
services.AddSingleton<HyperClient>();
services.AddHostedService<WindowsSystemWatcherWorker>()
.Configure<EventLogSettings>(config =>
{
config.LogName = "Hyper Windows Service";
config.SourceName = "Hyper Windows Service Source";
});
})
.UseWindowsService()
.Build()
.RunAsync();
}
}
}