public PerfTracker(string name, string userId, string userName, string location, string subject, string layer) { _sw = Stopwatch.StartNew(); _infoToLog = new LogDetail() { Message = name, UserId = userId, UserName = userName, Subject = subject, Layer = layer, Location = location, Hostname = Environment.MachineName }; var beginTime = DateTime.Now; _infoToLog.AdditionalInfo = new Dictionary <string, object>() { { "Started", beginTime.ToString(CultureInfo.InvariantCulture) } }; }
public static LogDetail GetWebLogDetail(string subject, string layer, string activityName, HttpContext context, Dictionary <string, object> additionalInfo = null) { var detail = new LogDetail { Subject = subject, Layer = layer, Message = activityName, Hostname = Environment.MachineName, CorrelationId = Activity.Current?.Id ?? context.TraceIdentifier, AdditionalInfo = additionalInfo ?? new Dictionary <string, object>() }; if (context != null) { GetUserData(detail, context); GetRequestData(detail, context); } // Session data?? // Cookie data?? return(detail); }
public static void WriteUsage(LogDetail infoToLog) { _usageLogger.Write(LogEventLevel.Information, "{@LogDetail}", infoToLog); }
public static void WritePerf(LogDetail infoToLog) { _perfLogger.Write(LogEventLevel.Information, "{@LogDetail}", infoToLog); }