log.cs

来自「ZX Messenger 文件传送服务器 用于传送用户自定义头像文件的辅助服务器」· CS 代码 · 共 45 行

CS
45
字号
using System;
using System.IO;
namespace gowk.utility.Exception
{
	/// <summary>
	/// Log 的摘要说明。
	/// </summary>
	public class Log
	{
		public static void Record(System.Exception ex)
		{
			string file=System.Environment.CurrentDirectory+"\\exception.log";
			try
			{
				System.IO.StreamWriter sw=new StreamWriter(file,true);
				sw.WriteLine("#######################################");
				sw.WriteLine("message:"+ex.Message);
				sw.WriteLine("Source:"+ex.Source);
				sw.WriteLine("StackTrace:"+ex.StackTrace);
				sw.WriteLine("InnerException:"+ex.InnerException);
				sw.WriteLine("#######################################");
				sw.Close();
			}
			catch
			{
			}
		}
		public static void Record(string message)
		{
			string file=System.Environment.CurrentDirectory+"\\exception.log";
			try
			{
				System.IO.StreamWriter sw=new StreamWriter(file,true);
				sw.WriteLine("#######################################");
				sw.WriteLine("message:"+message);
				sw.WriteLine("#######################################");
				sw.Close();
			}
			catch
			{
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?