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#:写日志函数
当前链接:https://www.cdcxhl.com/article14/jcjhge.html

成都网站建设公司_创新互联,为您提供软件开发外贸网站建设网站改版全网营销推广营销型网站建设

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设