新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

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.wjwzjz.com/article/jcjhge.html
在线咨询
服务热线
服务热线:028-86922220
TOP