コード例 #1
0
        /// <summary>
        /// 对象添加 的日志
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="user"></param>
        /// <param name="tag"></param>
        /// <param name="t"></param>
        /// <param name="ip"></param>
        public async Task InsertLogAsync <T>(CurrentUser curUser, string tag, T t) where T : class, new()
        {
            OperateLog log = new OperateLog
            {
                Tag        = tag,
                Content    = ObjectToStr(t, "UpdatePerson,UpdateDate"),
                Operator   = curUser.RealName,
                OperatorId = curUser.Id,
                IP         = curUser.LoginIPAddress
            };

            log.Id = log.CreateId();
            await OperateLogRep.AddAsync(log);
        }
コード例 #2
0
        /// <summary>
        /// 自定义 日志内容
        /// </summary>
        /// <param name="uinfo"></param>
        /// <param name="tag"></param>
        /// <param name="content"></param>
        public async Task CustomLogAsync(CurrentUser curUser, string tag, string content)
        {
            OperateLog log = new OperateLog
            {
                Tag        = tag,
                Content    = content,
                Operator   = curUser.RealName,
                OperatorId = curUser.Id,
                IP         = curUser.LoginIPAddress
            };

            log.Id = log.CreateId();
            if (!string.IsNullOrWhiteSpace(content))
            {
                await OperateLogRep.AddAsync(log);
            }
        }