| | |
| | | protected Stopwatch stopwatch = new Stopwatch(); |
| | | protected T LogInfo { get; private set; } |
| | | |
| | | private ILogger _logger; |
| | | public JobBase(T logInfo,ILogger logger) |
| | | public JobBase(T logInfo) |
| | | { |
| | | LogInfo = logInfo; |
| | | _logger = logger; |
| | | } |
| | | |
| | | public async Task Execute(IJobExecutionContext context) |
| | |
| | | return; |
| | | } |
| | | //记录执行次数 |
| | | var runNumber = context.JobDetail.JobDataMap.GetLong(Constant.RUNNUMBER); |
| | | long runNumber = 0; |
| | | try |
| | | { |
| | | runNumber = context.JobDetail.JobDataMap.GetLong(Constant.RUNNUMBER); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | context.JobDetail.JobDataMap[Constant.RUNNUMBER] = ++runNumber; |
| | | |
| | | var logs = context.JobDetail.JobDataMap[Constant.LOGLIST] as List<string> ?? new List<string>(); |
| | |
| | | |
| | | public abstract Task NextExecute(IJobExecutionContext context); |
| | | |
| | | public async Task WarningAsync(string title, string msg) |
| | | { |
| | | _logger.Warning(msg); |
| | | } |
| | | //public async Task WarningAsync(string title, string msg) |
| | | //{ |
| | | // _logger.Warning(msg); |
| | | //} |
| | | |
| | | public async Task InformationAsync(string title, string msg) |
| | | { |
| | | _logger.Information(msg); |
| | | } |
| | | //public async Task InformationAsync(string title, string msg) |
| | | //{ |
| | | // _logger.Information(msg); |
| | | //} |
| | | |
| | | public async Task ErrorAsync(string title, Exception ex, string msg) |
| | | { |
| | | _logger.Error(ex, msg); |
| | | } |
| | | //public async Task ErrorAsync(string title, Exception ex, string msg) |
| | | //{ |
| | | // _logger.Error(ex, msg); |
| | | //} |
| | | } |
| | | } |