修改日志

This commit is contained in:
陈国伟 2021-09-17 11:20:39 +08:00
parent 89a952bc94
commit 2c1fee746f
5 changed files with 9 additions and 11 deletions

View File

@ -37,7 +37,6 @@ namespace FastGithub.DomainResolve
try try
{ {
await this.dnscryptProxy.StartAsync(cancellationToken); await this.dnscryptProxy.StartAsync(cancellationToken);
this.logger.LogInformation($"已监听dns://{this.dnscryptProxy.LocalEndPoint}{this.dnscryptProxy}启动完成");
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -55,7 +54,6 @@ namespace FastGithub.DomainResolve
try try
{ {
this.dnscryptProxy.Stop(); this.dnscryptProxy.Stop();
this.logger.LogInformation($"{this.dnscryptProxy}已停止");
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -41,7 +41,7 @@ namespace FastGithub
var logger = kestrel.GetLogger(); var logger = kestrel.GetLogger();
kestrel.Listen(IPAddress.Loopback, httpProxyPort); kestrel.Listen(IPAddress.Loopback, httpProxyPort);
logger.LogInformation($"已监听http://127.0.0.1:{httpProxyPort}http代理启动完成"); logger.LogInformation($"已监听http://127.0.0.1:{httpProxyPort}http代理服务启动完成");
} }
/// <summary> /// <summary>
@ -54,7 +54,7 @@ namespace FastGithub
if (LocalMachine.CanListenTcp(SSH_PORT) == true) if (LocalMachine.CanListenTcp(SSH_PORT) == true)
{ {
kestrel.Listen(IPAddress.Loopback, SSH_PORT, listen => listen.UseConnectionHandler<SshReverseProxyHandler>()); kestrel.Listen(IPAddress.Loopback, SSH_PORT, listen => listen.UseConnectionHandler<SshReverseProxyHandler>());
kestrel.GetLogger().LogInformation($"已监听ssh://127.0.0.1:{SSH_PORT}ssh反向代理到github启动完成"); kestrel.GetLogger().LogInformation($"已监听ssh://127.0.0.1:{SSH_PORT}github的ssh反向代理服务启动完成");
} }
} }
@ -68,7 +68,7 @@ namespace FastGithub
if (LocalMachine.CanListenTcp(HTTP_PORT) == true) if (LocalMachine.CanListenTcp(HTTP_PORT) == true)
{ {
kestrel.Listen(IPAddress.Loopback, HTTP_PORT); kestrel.Listen(IPAddress.Loopback, HTTP_PORT);
kestrel.GetLogger().LogInformation($"已监听http://127.0.0.1:{HTTP_PORT}http反向代理启动完成"); kestrel.GetLogger().LogInformation($"已监听http://127.0.0.1:{HTTP_PORT}http反向代理服务启动完成");
} }
} }
@ -103,7 +103,7 @@ namespace FastGithub
if (httpsPort == 443) if (httpsPort == 443)
{ {
var logger = kestrel.GetLogger(); var logger = kestrel.GetLogger();
logger.LogInformation($"已监听https://127.0.0.1:{httpsPort}https反向代理启动完成"); logger.LogInformation($"已监听https://127.0.0.1:{httpsPort}https反向代理服务启动完成");
} }
return httpsPort; return httpsPort;

View File

@ -5,11 +5,11 @@ using System.Threading.Tasks;
namespace FastGithub namespace FastGithub
{ {
sealed class VersonHostedService : IHostedService sealed class AppHostedService : IHostedService
{ {
private readonly ILogger<VersonHostedService> logger; private readonly ILogger<AppHostedService> logger;
public VersonHostedService(ILogger<VersonHostedService> logger) public AppHostedService(ILogger<AppHostedService> logger)
{ {
this.logger = logger; this.logger = logger;
} }
@ -23,6 +23,7 @@ namespace FastGithub
public Task StopAsync(CancellationToken cancellationToken) public Task StopAsync(CancellationToken cancellationToken)
{ {
this.logger.LogInformation($"{nameof(FastGithub)}止停止运行");
return Task.CompletedTask; return Task.CompletedTask;
} }
} }

View File

@ -48,7 +48,6 @@ namespace FastGithub
.ConfigureWebHostDefaults(webBuilder => .ConfigureWebHostDefaults(webBuilder =>
{ {
webBuilder.UseStartup<Startup>(); webBuilder.UseStartup<Startup>();
webBuilder.UseShutdownTimeout(TimeSpan.FromSeconds(2d));
webBuilder.UseKestrel(kestrel => webBuilder.UseKestrel(kestrel =>
{ {
kestrel.NoLimit(); kestrel.NoLimit();

View File

@ -35,7 +35,7 @@ namespace FastGithub
services.AddDomainResolve(); services.AddDomainResolve();
services.AddHttpClient(); services.AddHttpClient();
services.AddReverseProxy(); services.AddReverseProxy();
services.AddHostedService<VersonHostedService>(); services.AddHostedService<AppHostedService>();
if (OperatingSystem.IsWindows()) if (OperatingSystem.IsWindows())
{ {