Ejemplo n.º 1
0
        public static string GetSymbol(this LogPartType part)
        {
            switch (part)
            {
            case LogPartType.Client:
                return("C");

            case LogPartType.Server:
                return("S");

            case LogPartType.Other:
                return("O");

            default:
                return(null);
            }
        }
Ejemplo n.º 2
0
        public void Log(string connectorId, string session, IPEndPoint local, IPEndPoint remote, LogPartType part,
                        LogEventType type,
                        string data)
        {
            ILog logger;

            switch (part)
            {
            case LogPartType.Client:
                logger = LoggerClient;
                break;

            case LogPartType.Server:
                logger = LoggerServer;
                break;

            default:
                logger = LoggerOther;
                break;
            }

            var sequence = SequenceNumbers[session];

            SequenceNumbers[session] = sequence + 1;


            logger.Info(new LogEvent
            {
                ConnectorId    = connectorId,
                LocalIP        = local,
                RemoteIP       = remote,
                Message        = data,
                Session        = session,
                Type           = type.GetSymbol(),
                SequenceNumber = sequence
            });
        }
Ejemplo n.º 3
0
 public void Log(string connectorId, string session, IPEndPoint local, IPEndPoint remote, LogPartType part,
                 LogEventType type,
                 string data)
 {
     if (type.IsConnectionEvent())
     {
         Console.WriteLine("[{0}] {1}{2}  L:{3} R:{4}", connectorId, part.GetSymbol(), type.GetSymbol(),
                           local, remote);
     }
     else
     {
         foreach (var l in (data ?? "").Split(new[] { "\r\n" }, StringSplitOptions.None))
         {
             Console.WriteLine("[{0}] {1}{2} {3}", connectorId, part.GetSymbol(), type.GetSymbol(), l);
         }
     }
 }