示例#1
0
        public LogDTO AddExceptionLog(ExceptionLogDTO logDto)
        {
            User user = null;

            //this check must be move to domain servi
            if (!string.IsNullOrWhiteSpace(logDto.UserName))
            {
                user = userRep.GetUserById(new PartyId(logDto.UserName));
            }
            var log = logService.AddExceptionLog(logDto.Code, LogLevel.FromDisplayName <LogLevel>(logDto.LogLevel),
                                                 user, logDto.ClassName, logDto.MethodName, logDto.Title, logDto.Messages);

            return(logDTOMapper.MapToModel(log));
        }
示例#2
0
        public LogDTO AddEventLog(string title, string code, string logLevel, string className, string methodName, string messages,
                                  string userName)
        {
            User user = null;

            //this check must be move to domain servi
            if (!string.IsNullOrWhiteSpace(userName))
            {
                user = userRep.GetUserById(new PartyId(userName));
            }
            var log = logService.AddEventLog(code, LogLevel.FromDisplayName <LogLevel>(logLevel),
                                             user, className, methodName, title, messages);

            return(logDTOMapper.MapToModel(log));
        }
示例#3
0
        public LogManagerService(ILoggerServiceFactory loggerFactory)
        {
            this.loggerFactory = loggerFactory;
            var loggerKeys = (loggerServiceKeys != null) ? loggerServiceKeys.Split(',') : new string[] { };

            if (loggerKeys.Any())
            {
                primaryLoggerKey = loggerKeys[0];
            }

            if (loggerKeys.Length > 1)
            {
                secondaryLoggerKey = loggerKeys[1];
            }
            if (!string.IsNullOrWhiteSpace(logLevelTypeNames))
            {
                var levelList = logLevelTypeNames.Split(',');
                logLevels = levelList.Select(l => LogLevel.FromDisplayName <LogLevel>(l)).ToList();
            }
        }