Beispiel #1
0
        //methods
        public virtual void LogWebUsage(string activityName,
                                        Dictionary <string, object> additionalInfo = null)
        {
            string userId, userName, location;
            Dictionary <string, object> webInfo = GetWebLoggingData(out userId, out userName, out location);

            if (additionalInfo != null)
            {
                foreach (string key in additionalInfo.Keys)
                {
                    webInfo.Add($"Info-{key}", additionalInfo[key]);
                }
            }

            var usageInfo = new LogDetail()
            {
                Product        = _logsSettings.Product,
                Layer          = _logsSettings.Layer,
                TimestampUtc   = DateTime.UtcNow,
                Location       = location,
                UserId         = userId,
                UserName       = userName,
                Hostname       = Environment.MachineName,
                CorrelationId  = HttpContext.Current.Session?.SessionID,
                Message        = activityName,
                AdditionalInfo = webInfo
            };

            _logsWriter.WriteUsage(usageInfo);
        }
Beispiel #2
0
        //methods
        public virtual void LogDiagnostic(string message, object additionalInfo = null)
        {
            LogDetail logEntry = GetWcfLogEntry(message, additionalInfo);

            _logsWriter.WriteUsage(logEntry);
        }