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://hxwzsj.com/article/jcjhge.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 外贸营销网站建设 成都网站建设 成都网站建设公司 成都企业网站制作 响应式网站设计 成都网站制作 网站建设方案 企业网站建设公司 品牌网站建设 营销型网站建设 成都网站制作 宜宾网站设计 自适应网站设计 网站建设公司 app网站建设 成都网站设计 网站建设方案 成都网站制作 成都网站建设 上市集团网站建设 营销型网站建设 成都网站设计