Yuebon.NetCore/Yuebon.Commons/Helpers/FileQuartz.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Quartz;
using System.IO;
using Yuebon.Commons.Enums;
using Yuebon.Commons.Extend;

namespace Yuebon.Commons.Helpers
{
    /// <summary>
    /// 定时任务日志文件
    /// </summary>
    public class FileQuartz
    {
        private static string _rootPath { get; set; }

        private static string _logPath { get; set; }
        /// <summary>
        /// 创建作业所在根目录及日志文件夹 
        /// </summary>
        /// <returns></returns>
        public static string CreateQuartzRootPath()
        {
            if (!string.IsNullOrEmpty(_rootPath))
                return _rootPath;
            _rootPath = AppDomain.CurrentDomain.BaseDirectory;
            _rootPath = _rootPath.ReplacePath();
            if (!Directory.Exists(_rootPath))
            {
                Directory.CreateDirectory(_rootPath);
            }
            _rootPath = _rootPath +  "Logs\\Quartz\\";
            _rootPath = _rootPath.ReplacePath();
            //生成日志文件夹
            if (!Directory.Exists(_rootPath))
            {
                Directory.CreateDirectory(_rootPath);
            }
            return _rootPath;
        }

        /// <summary>
        /// 初始化任务日志文件路径
        /// </summary>
        /// <param name="jobName">任务名称</param>
        public static void InitTaskJobLogPath(long jobName)
        {
            if (string.IsNullOrEmpty(_logPath))
            {
                CreateQuartzRootPath();
            }
            _logPath = _rootPath + jobName;
            _logPath = _logPath.ReplacePath();
            //生成日志文件夹
            if (!Directory.Exists(_logPath))
            {
                Directory.CreateDirectory(_logPath);
            }
        }
        /// <summary>
        /// 任务启动日志
        /// </summary>
后面还有 64 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。