Пример #1
0
        private static int GetRequestId()
        {
            KCRequestLogInq graph   = CreateInstance <KCRequestLogInq>();
            KCLog           lastLog = graph.LastLog.SelectSingle();

            return(lastLog?.RequestId + 1 ?? 1);
        }
        private static int GetRequestId()
        {
            KCRequestLogInq graph   = CreateInstance <KCRequestLogInq>();
            KCLog           lastLog = graph.LastLog.SelectSingle();

            return(lastLog != null?lastLog.RequestId.GetValueOrDefault() + 1 : 1);
        }
        public static KCLog GetLastLog()
        {
            KCRequestLogInq graph   = CreateInstance <KCRequestLogInq>();
            KCLog           lastLog = graph.LastLog.SelectSingle();

            return(lastLog);
        }
Пример #4
0
        public void Write(LogEvent logInfo)
        {
            KCLog log = _graph.Logs.Insert();

            MapLogInfoData(logInfo, log);

            _graph.Persist();
        }
Пример #5
0
 public void Write(IList <LogEvent> logEvents)
 {
     foreach (LogEvent logEvent in logEvents)
     {
         KCLog log = _graph.Logs.Insert();
         MapLogInfoData(logEvent, log);
     }
     _graph.Persist();
 }
Пример #6
0
        private void MapLogInfoData(LogEvent logEvent, KCLog log)
        {
            log.RequestId  = int.Parse(logEvent.Properties[KCLoggerConstants.RequestId].ToString());
            log.EntityType = logEvent.Properties[KCLoggerConstants.EntityType].RemoveNonAlphanumerical();
            log.ActionName = logEvent.Properties[KCLoggerConstants.ActionName].RemoveNonAlphanumerical();

            var entityId = logEvent.Properties[KCLoggerConstants.EntityId];

            if (entityId != null && entityId.ToString() != "null")
            {
                log.EntityId = entityId.RemoveNonAlphanumerical();
            }
            var parentEntityId = logEvent.Properties[KCLoggerConstants.ParentEntityId];

            if (parentEntityId != null && parentEntityId.ToString() != "null")
            {
                log.ParentEntityId = parentEntityId.RemoveNonAlphanumerical();
            }

            log.Level = logEvent.Level.ToString();
            string message = logEvent.RenderMessage(_context.FormatProvider);

            log.Description = message.Length > KCLoggerConstants.DescriptionLength ? message.Substring(0, KCLoggerConstants.DescriptionLength) : message;
        }
        public static int GetRequestId()
        {
            KCLog lastLog = GetLastLog();

            return(lastLog != null?lastLog.RequestId.GetValueOrDefault() + 1 : 1);
        }