示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="fn">为空字符串则表示不开启</param>
        public static void init(string fn, LoggerLvl lvl)
        {
            _createdDayOfYear = -1;

            if ("" == fn)
            {
                WriteStr2("you need set fileName for WriteFile!");
            }

            _fileName = fn;

            _lvl = lvl;

            string fileFullDir = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + fileDir;

            if(fileIsExist(fileFullDir,FsoMethod.Folder))
            {
            
            }else
            {
                WriteStr2("[LOG] " + fileFullDir);
                Directory.CreateDirectory(fileFullDir);
            
            }

              
            //不可调用clear,否则把别的也删了
            //Trace.Listeners.Clear();
            Trace.AutoFlush = true;

        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fn">为空字符串则表示不开启</param>
        public static void init(string fn, LoggerLvl lvl)
        {
            _createdDayOfYear = -1;

            if ("" == fn)
            {
                WriteStr2("you need set fileName for WriteFile!");
            }

            _fileName = fn;

            _lvl = lvl;

            string fileFullDir = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + fileDir;

            if (fileIsExist(fileFullDir, FsoMethod.Folder))
            {
            }
            else
            {
                WriteStr2("[LOG] " + fileFullDir);
                Directory.CreateDirectory(fileFullDir);
            }


            //不可调用clear,否则把别的也删了
            //Trace.Listeners.Clear();
            Trace.AutoFlush = true;
        }