C#:写日志函数

写日志函数

        public static void WriteLog( string strLog )
        {
            string strDate = DateTime.Now.ToString( g_strDateFormate );
            string strLogDir = AppDomain.CurrentDomain.BaseDirectory + "Log\\SysLog\\";
            if ( !Directory.Exists( strLogDir ) )
                Directory.CreateDirectory( strLogDir );

            string strDateTime = DateTime.Now.ToString( g_strDateTimeFormate_2 );
            strLog = string.Format( "[{0}] {1}\r\n", strDateTime, strLog );

            string strLogFilePath = string.Format( "{0}/{1}.txt", strLogDir, strDate );
            File.AppendAllText( strLogFilePath, strLog );
        }

本文题目:C#:写日志函数
链接地址:http://www.csruizhi.cn/article/jcjhge.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 高端网站设计推广 古蔺网站建设 营销型网站建设 高端网站设计 盐亭网站设计 成都网站制作 成都网站设计 手机网站设计 网站建设 成都网站设计 外贸营销网站建设 成都网站设计制作公司 成都网站制作 成都企业网站制作 高端网站设计 成都网站建设 商城网站建设 专业网站建设 成都网站建设 成都网站建设 成都商城网站建设 成都网站设计