/// <summary>
 /// Log message to <see cref="ILogWriter"/>
 /// </summary>
 /// <param name="requestContext">Request context.</param>
 /// <param name="logFlag">Log flag.</param>
 /// <param name="message">Log message.</param>
 /// <returns></returns>
 private async Task Log(HttpRequestContext requestContext, LogFlag logFlag, StringBuilder message)
 {
     message.AppendLine("");
     await requestContext.LogWriter.Log(
         logFlag.ToString(),
         message.ToString());
 }
Exemple #2
0
        /// <summary>
        /// 写数据库操作日志
        /// </summary>
        /// <param name="loginInfo">登录信息</param>
        /// <param name="flag_lx">日志类型</param>
        /// <param name="content">内容</param>
        public void Add(Hashtable loginInfo, LogFlag flag_lx, string content)
        {
            HttpContext context = HttpContext.Current;
            Ts_Log      log     = new Ts_Log();

            log.id        = Guid.NewGuid().ToString();
            log.IP        = context.Request.UserHostAddress;
            log.id_user   = string.Format("{0}", loginInfo["id_user"]);
            log.flag_lx   = flag_lx.ToString();
            log.content   = content;
            log.flag_from = ((FromFlag)(loginInfo["flag_from"] ?? 0)).ToString();
            log.rq        = DateTime.Now;
            if (loginInfo.ContainsKey("ip") && !string.IsNullOrEmpty(loginInfo["ip"].ToString()))
            {
                log.IP = loginInfo["ip"].ToString();
            }
            DAL.Add(log);
        }