/// <summary> /// Function to add LogDataItem to our internal store /// </summary> /// <param name="logData">Contains data about a Padarn page access</param> /// <remarks>This function logs everything; it'd be advisable to define rules as to what to log</remarks> internal static void AddLogDataItem(LogDataItem logData, ServerConfig serverConfig) { if (logData != null && serverConfig != null) { string userAgentString = logData.Headers[USER_AGENT]; GetBrowserType.BrowserType browser = GetBrowserType.DetermineBrowserType(userAgentString); //Add record to data structure _logRecords.Add(new ClientRequestInfo(logData.PageName, logData.RemoteClientIP, serverConfig.Cookies.Domain != null, serverConfig.UseSsl, browser, Events.PageLoad, DateTime.Now)); } }
/// <summary> /// Method to store away error record /// </summary> /// <param name="errorInfo">String representing error text</param> /// <param name="logData">Contains data about a Padarn page access</param> /// <param name="serverConfig">ServerConfiguration of Padarn instance</param> /// <remarks>logData will likely be null</remarks> internal static void AddErrorItem(string errorInfo, LogDataItem logData, ServerConfig serverConfig) { string pageName = logData != null ? logData.PageName : errorInfo; string remoteIP = logData != null ? logData.RemoteClientIP : String.Empty; GetBrowserType.BrowserType browser = GetBrowserType.BrowserType.Unknown; if (logData != null) { string userAgentString = logData.Headers[USER_AGENT]; browser = GetBrowserType.DetermineBrowserType(userAgentString); } _logRecords.Add(new ClientRequestInfo(pageName, remoteIP, serverConfig.Cookies.Domain != null, serverConfig.UseSsl, browser, ParseErrorCode(errorInfo), DateTime.Now)); }