コード例 #1
0
        public void WriteDbLog(bool result, string resultLog)
        {
            LogEntity logEntity = new LogEntity();

            logEntity.F_Id            = Common.GuId();
            logEntity.F_Date          = DateTime.Now;
            logEntity.F_Account       = OperatorProvider.Provider.GetCurrent().UserCode;
            logEntity.F_NickName      = OperatorProvider.Provider.GetCurrent().UserName;
            logEntity.F_IPAddress     = Net.Ip;
            logEntity.F_IPAddressName = Net.GetLocation(logEntity.F_IPAddress);
            logEntity.F_Result        = result;
            logEntity.F_Description   = resultLog;
            logEntity.Create();
            service.Insert(logEntity);
        }
コード例 #2
0
        private void LogRequest(HttpContext context)
        {
            if (context.Request.IsAjaxRequest())
            {
                _logger.LogEntity = LogEntity.Create(Context.CurrentAccount.AccountName,
                                                     "Request Ajax Url: " + context.Request.Path.Value, "App");
            }
            else
            {
                _logger.LogEntity = LogEntity.Create(Context.CurrentAccount.AccountName,
                                                     "Request Url: " + context.Request.Path.Value, "App");
            }


            _logger.WriteInfo();
        }
コード例 #3
0
ファイル: TableLogger.cs プロジェクト: LykkeCity/SolarCoinApi
        private async Task Insert(string level, string component, string process, string context, string type, string stack,
                                  string msg, DateTime?dateTime)
        {
            var dt        = dateTime ?? DateTime.UtcNow;
            var newEntity = LogEntity.Create(level, component, process, context, type, stack, msg, dt);

            if (level == "error" || level == "fatalerror")
            {
                await _errorTableStorage.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt);
            }
            if (level == "warning")
            {
                await _warningTableStorage.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt);
            }
            if (level == "info")
            {
                await _infoTableStorage.InsertAndGenerateRowKeyAsTimeAsync(newEntity, dt);
            }
        }
コード例 #4
0
        /// <summary>
        /// 创建日志信息
        /// </summary>
        /// <param name="result"></param>
        /// <param name="resultLog"></param>
        public void WriteDbLog(bool result, string resultLog)
        {
            LogEntity logEntity = new LogEntity();

            logEntity.F_Id            = Common.GuId();
            logEntity.F_Date          = DateTime.Now;
            logEntity.F_Account       = OperatorProvider.Provider.GetCurrent().UserCode;
            logEntity.F_NickName      = OperatorProvider.Provider.GetCurrent().UserName;
            logEntity.F_IPAddress     = Net.Ip;
            logEntity.F_IPAddressName = Net.GetLocation(logEntity.F_IPAddress);
            logEntity.F_Result        = result;
            logEntity.F_Description   = resultLog;
            logEntity.Create();
            ResultClass <int> _ret = service.Insert(logEntity);

            if (!_ret.Result)
            {
                throw new Exception(_ret.ErrorMessage);
            }
        }