400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

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

其他资讯

让你的专属顾问为你服务