Пример #1
0
        internal static void LogProtocolFailure(string operation, IList <string> requestIds, IList <string> cookies, string message, string userName, string protocolSequence, string clientAddress, string organization, Exception exception)
        {
            ProtocolLogSession protocolLogSession = ProtocolLog.CreateSession(0, clientAddress, null, protocolSequence);

            if (!string.IsNullOrEmpty(organization))
            {
                protocolLogSession[ProtocolLog.Field.OrganizationInfo] = organization;
            }
            string text = string.Empty;

            if (cookies != null && cookies.Count > 0)
            {
                text = string.Join("|", cookies);
            }
            string text2 = string.Empty;

            if (requestIds != null && requestIds.Count > 0)
            {
                text2 = string.Join("|", requestIds);
            }
            string arg = string.Empty;

            if (!string.IsNullOrEmpty(text) || !string.IsNullOrEmpty(text2))
            {
                arg = string.Format(" [{0}{1}{2}]", text, string.IsNullOrEmpty(text) ? string.Empty : ";", text2);
            }
            string arg2 = string.Empty;

            if (!string.IsNullOrEmpty(userName))
            {
                arg2 = string.Format(" [{0}]", userName);
            }
            protocolLogSession.AppendProtocolFailure(operation, string.Format("{0}{1}{2}", message, arg2, arg), exception.LogMessage(true));
        }
Пример #2
0
        internal static ProtocolLogSession CreateSession(int sessionId, string clientAddress, string serverAddress, string protocolSequence)
        {
            ProtocolLogSession protocolLogSession = new ProtocolLogSession(new LogRowFormatter(ProtocolLog.Schema));

            protocolLogSession[ProtocolLog.Field.SessionId] = sessionId;
            if (!string.IsNullOrEmpty(clientAddress))
            {
                protocolLogSession[ProtocolLog.Field.ClientIp] = clientAddress;
            }
            if (!string.IsNullOrEmpty(serverAddress))
            {
                protocolLogSession[ProtocolLog.Field.ServerIp] = string.Intern(serverAddress);
            }
            if (!string.IsNullOrEmpty(protocolSequence))
            {
                protocolLogSession[ProtocolLog.Field.Protocol] = string.Intern(protocolSequence);
            }
            return(protocolLogSession);
        }