增加几行日志

This commit is contained in:
SpringHgui 2020-01-05 12:11:05 +08:00
parent ab29a062ff
commit 0b4883f162
4 changed files with 14 additions and 4 deletions

View File

@ -21,6 +21,7 @@ namespace FastTunnel.Client
{
LogManager.LoadConfiguration("Nlog.config");
var logger = LogManager.GetCurrentClassLogger();
logger.Debug("===== Sevice Start =====");
try
{

View File

@ -70,7 +70,14 @@ namespace FastTunnel.Core
private void ReceiveCustomer(object state)
{
var client = state as Socket;
handler.Invoke(client, _data);
try
{
handler.Invoke(client, _data);
}
catch (Exception ex)
{
_logerr.LogError(ex);
}
}
public void ShutdownAndClose()

View File

@ -79,8 +79,9 @@ namespace FastTunnel.Core.Server
client.Close();
return;
}
catch (Exception)
catch (Exception ex)
{
_logger.LogError(ex);
throw;
}
@ -256,6 +257,8 @@ namespace FastTunnel.Core.Server
// listen success
SSHList.Add(item.RemotePort, new SSHInfo<SSHHandlerArg> { Listener = ls, Socket = client, SSHConfig = item });
_logger.LogDebug($"SSH proxy success: {item.RemotePort} -> {item.LocalIp}:{item.LocalPort}");
client.Send(new Message<string> { MessageType = MessageType.Info, Content = $"TunnelForSSH is OK: {requet.ClientConfig.Common.ServerAddr}:{item.RemotePort}->{item.LocalIp}:{item.LocalPort}" });
}
catch (Exception ex)
{
@ -264,8 +267,6 @@ namespace FastTunnel.Core.Server
client.Send(new Message<string> { MessageType = MessageType.Error, Content = ex.Message });
continue;
}
client.Send(new Message<string> { MessageType = MessageType.Info, Content = $"TunnelForSSH is OK: {requet.ClientConfig.Common.ServerAddr}:{item.RemotePort}->{item.LocalIp}:{item.LocalPort}" });
}
}

View File

@ -27,6 +27,7 @@ namespace FastTunnel.Server
{
LogManager.LoadConfiguration("Nlog.config");
var logger = LogManager.GetCurrentClassLogger();
logger.Debug("===== Sevice Start =====");
try
{