mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
using Remotely.Shared.Services;
|
|
|
|
namespace Remotely.Server
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
CreateWebHostBuilder(args).Build().Run();
|
|
}
|
|
|
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
|
WebHost.CreateDefaultBuilder(args)
|
|
.UseStartup<Startup>()
|
|
.CaptureStartupErrors(true)
|
|
.ConfigureLogging((hostingContext, logging) =>
|
|
{
|
|
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
|
|
logging.AddConsole();
|
|
logging.AddDebug();
|
|
|
|
if (bool.TryParse(hostingContext.Configuration["ApplicationOptions:EnableWindowsEventLog"], out var enableEventLog))
|
|
{
|
|
if (OSUtils.IsWindows && enableEventLog)
|
|
{
|
|
logging.AddEventLog(settings => {
|
|
settings.LogName = "Remotely_Server";
|
|
settings.SourceName = "Remotely_Server";
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|