private static string BuildExtraDataString(UserContext userContext, Datapoint contextHeader, Datapoint[] context, List <ClientWatsonDatapointHandler.ClientWatsonReportLogEvent> eventsToLog)
        {
            string        text          = ClientWatsonDatapointHandler.FormatClientLogDataForWatson(contextHeader, context);
            StringBuilder stringBuilder = new StringBuilder(text.Length + "------------------------ClientLogs------------------------".Length + "---------------Watson events on this session--------------".Length);
            string        text2         = (userContext != null) ? userContext.LogEventCommonData.Features : null;
            string        text3         = (userContext != null) ? userContext.LogEventCommonData.Flights : null;

            stringBuilder.AppendLine("-------------------Features & Flights---------------------");
            stringBuilder.Append("Features: ");
            stringBuilder.AppendLine(string.IsNullOrEmpty(text2) ? "None" : text2);
            stringBuilder.Append("Flights: ");
            stringBuilder.AppendLine(string.IsNullOrEmpty(text3) ? "None" : text3);
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("---------------Watson events on this session--------------");
            if (userContext != null)
            {
                foreach (string value in userContext.GetClientWatsonHistory())
                {
                    stringBuilder.AppendLine(value);
                    stringBuilder.AppendLine();
                }
            }
            string[] array = new string[eventsToLog.Count];
            int      num   = 0;

            foreach (ClientWatsonDatapointHandler.ClientWatsonReportLogEvent clientWatsonReportLogEvent in eventsToLog)
            {
                OwaClientLogger.AppendToLog(clientWatsonReportLogEvent);
                string text4 = string.Format("{0}{1}{2}", clientWatsonReportLogEvent, Environment.NewLine, clientWatsonReportLogEvent.GetWatsonUrl());
                array[num++] = text4;
                stringBuilder.AppendLine(text4);
                stringBuilder.AppendLine();
            }
            if (userContext != null)
            {
                Array.Sort <string>(array);
                userContext.SaveToClientWatsonHistory(array);
            }
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("------------------------ClientLogs------------------------");
            stringBuilder.AppendLine(text);
            return(stringBuilder.ToString());
        }
 // Token: 0x06002512 RID: 9490 RVA: 0x00086317 File Offset: 0x00084517
 public OwaClientLogger() : base(new OwaClientLogConfiguration(), OwaClientLogger.GetEscapeLineBreaksConfigValue())
 {
 }
Esempio n. 3
0
        // Token: 0x06002543 RID: 9539 RVA: 0x000869C8 File Offset: 0x00084BC8
        internal static void LogHttpContextData(HttpContext httpContext, RequestDetailsLogger logger)
        {
            if (OwaServerLogger.instance == null || !OwaServerLogger.instance.Configuration.IsLoggingEnabled)
            {
                return;
            }
            if (logger.Get(ExtensibleLoggerMetadata.EventId) == null)
            {
                if (!logger.ActivityScope.Statistics.Any <KeyValuePair <OperationKey, OperationStatistics> >())
                {
                    return;
                }
                OwaServerLogger.SetEventId(httpContext, logger);
            }
            logger.Set(OwaServerLogger.LoggerData.ContentLength, httpContext.Request.ContentLength);
            logger.Set(ServiceLatencyMetadata.HttpPipelineLatency, httpContext.Items[ServiceLatencyMetadata.HttpPipelineLatency]);
            NameValueCollection headers = httpContext.Request.Headers;
            string value = headers["X-OWA-ActionId"];

            if (!string.IsNullOrEmpty(value))
            {
                logger.Set(OwaServerLogger.LoggerData.ClientActionId, value);
            }
            string value2 = headers["X-OWA-ActionName"];

            if (!string.IsNullOrEmpty(value2))
            {
                logger.Set(OwaServerLogger.LoggerData.ClientActionName, value2);
            }
            string value3 = headers["X-EXT-ClientName"];

            if (!string.IsNullOrEmpty(value3))
            {
                logger.Set(OwaServerLogger.LoggerData.ExternalClientName, value3);
            }
            string value4 = headers["X-EXT-CorrelationId"];

            if (!string.IsNullOrEmpty(value4))
            {
                logger.Set(OwaServerLogger.LoggerData.ExternalCorrelationId, value4);
            }
            string sourceCafeServer = CafeHelper.GetSourceCafeServer(httpContext.Request);

            if (!string.IsNullOrEmpty(sourceCafeServer))
            {
                logger.Set(OwaServerLogger.LoggerData.FrontEndServer, sourceCafeServer);
            }
            string value5 = headers["X-OWA-OfflineRejectCode"];

            if (!string.IsNullOrEmpty(value5))
            {
                logger.Set(OwaServerLogger.LoggerData.OfflineRejectCode, value5);
            }
            string text = headers["logonLatency"];
            bool   flag = UserContextUtilities.IsDifferentMailbox(httpContext);

            if (!string.IsNullOrEmpty(text) || flag)
            {
                IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(httpContext, null, false);
                if (!string.IsNullOrEmpty(text))
                {
                    logger.Set(OwaServerLogger.LoggerData.LogonLatencyName, text);
                    string userContext = string.Empty;
                    if (mailboxContext != null)
                    {
                        userContext = mailboxContext.Key.UserContextId.ToString(CultureInfo.InvariantCulture);
                    }
                    string[] keys = new string[]
                    {
                        "LGN.L"
                    };
                    string[] values = new string[]
                    {
                        text
                    };
                    Datapoint      datapoint = new Datapoint(DatapointConsumer.Analytics, "LogonLatency", DateTime.UtcNow.ToString("o"), keys, values);
                    ClientLogEvent logEvent  = new ClientLogEvent(datapoint, userContext);
                    OwaClientLogger.AppendToLog(logEvent);
                }
                if (flag && mailboxContext is SharedContext && httpContext.Items.Contains("CallContext"))
                {
                    CallContext callContext = httpContext.Items["CallContext"] as CallContext;
                    logger.Set(OwaServerLogger.LoggerData.User, callContext.GetEffectiveAccessingSmtpAddress());
                }
            }
            string value6 = httpContext.Items["BackEndAuthenticator"] as string;

            if (!string.IsNullOrEmpty(value6))
            {
                logger.Set(OwaServerLogger.LoggerData.BackendAuthenticator, value6);
            }
            object obj = httpContext.Items["TotalBERehydrationModuleLatency"];

            if (obj != null)
            {
                logger.Set(OwaServerLogger.LoggerData.RehydrationModuleLatency, obj);
            }
            string value7 = headers["X-OWA-Test-PassThruProxy"];

            if (!string.IsNullOrEmpty(value7))
            {
                logger.Set(OwaServerLogger.LoggerData.PassThroughProxy, value7);
            }
            string value8 = headers["X-SuiteServiceProxyOrigin"];

            if (!string.IsNullOrEmpty(value8))
            {
                logger.Set(OwaServerLogger.LoggerData.SuiteServiceProxyOrigin, value8);
            }
            HttpCookie httpCookie = httpContext.Request.Cookies["ClientId"];

            if (httpCookie != null)
            {
                logger.Set(OwaServerLogger.LoggerData.ClientId, httpCookie.Value);
            }
        }