public static void LogWebUsage(string product, string layer, string activityName, Dictionary <string, object> additionalInfo = null) { string userId, userName, location; var webInfo = GetWebFloggingData(out userId, out userName, out location); if (additionalInfo != null) { foreach (var key in additionalInfo.Keys) { webInfo.Add($"Info-{key}", additionalInfo[key]); } } var usageInfo = new HylogDetails() { Product = product, Layer = layer, TimeStamp = DateTime.Now, Location = location, UserId = userId, UserName = userName, HostName = Environment.MachineName, CorrelationId = HttpContext.Current.Session.SessionID, Message = activityName, AdditionalInfo = webInfo }; Hlogger.WriteUsage(usageInfo); }
public static void LogWebError(string product, string layer, Exception ex) { string userId, userName, location; var webInfo = GetWebFloggingData(out userId, out userName, out location); var errorInformation = new HylogDetails() { Product = product, Layer = layer, Location = location, TimeStamp = DateTime.Now, UserId = userId, UserName = userName, HostName = Environment.MachineName, CorrelationId = HttpContext.Current.Session?.SessionID, Exception = ex, AdditionalInfo = webInfo }; Hlogger.WriteError(errorInformation); }
public static void LogWebDiagnostic(string product, string layer, string message, Dictionary <string, object> diagnosticInfo = null) { var writeDiagnostics = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableDiagnostics"]); if (!writeDiagnostics) // doing this to avoid going through all the data - user, session, etc. { return; } string userId, userName, location; var webInfo = GetWebFloggingData(out userId, out userName, out location); if (diagnosticInfo != null) { foreach (var key in diagnosticInfo.Keys) { webInfo.Add(key, diagnosticInfo[key]); } } var diagInfo = new HylogDetails() { Product = product, Layer = layer, Location = location, TimeStamp = DateTime.Now, UserId = userId, UserName = userName, HostName = Environment.MachineName, CorrelationId = HttpContext.Current.Session.SessionID, Message = message, AdditionalInfo = webInfo }; Hlogger.WriteDiagonistic(diagInfo); }