示例#1
0
        public override string Register()
        {
            try
            {
                JobId = BackgroundJob.Enqueue(() => Trigger(this));

                Nlogger.Info($"The [{JobId}] added to hangfire fire and forget jobs successful.");

                return(JobId);
            }
            catch (Exception exp)
            {
                Nlogger.Fatal(exp);
                return(exp.Message);
            }
        }
示例#2
0
        public override string Register()
        {
            try
            {
                JobId = BackgroundJob.Schedule(() => Trigger(this), TriggerOn);

                Nlogger.Info($"The [{JobId}] added to hangfire delayed jobs successful.");

                return(JobId);
            }
            catch (Exception exp)
            {
                Nlogger.Fatal(exp);
                return(exp.Message);
            }
        }
示例#3
0
        public override string Register()
        {
            try
            {
                JobId = $"{Name ?? ActionName}: {DateTime.Now.GetHashCode()}";

                RecurringJob.AddOrUpdate(JobId, () => Trigger(this), TriggerOn, TimeZoneInfo.Local);

                Nlogger.Info($"The [{JobId}] added to hangfire recurring jobs successful.");

                return(JobId);
            }
            catch (Exception exp)
            {
                Nlogger.Fatal(exp);
                return(exp.Message);
            }
        }
示例#4
0
 /// <summary>
 /// 记录Info级日志
 /// </summary>
 /// <param name="err">程序异常</param>
 /// <param name="msg">格式化消息</param>
 /// <param name="args">格式参数</param>
 public void Info(Exception err, string msg, params object[] args) => Nlogger.Info(err, msg, args);
示例#5
0
 /// <summary>
 /// 记录Info级日志
 /// </summary>
 /// <param name="msg">格式化消息</param>
 /// <param name="args">格式参数</param>
 public void Info(string msg, params object[] args) => Nlogger.Info(msg, args);