📄 printlog.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
public class PrintLog
{
/// <summary>
/// 异常日志
/// </summary>
/// <param name="path">根目录</param>
/// <param name="log">异常内容</param>
public static void PrintError(string path, string log)
{
path += "systemlog/" + DateTime.Now.ToString("yyyyMMdd") + ".log";
if (!File.Exists(path))
{
StreamWriter Create = new StreamWriter(path, true, System.Text.Encoding.Default);
Create.Close();
}
StreamWriter writelog = new StreamWriter(path, true, System.Text.Encoding.Default);
writelog.WriteLine(DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second + ":" + log);
writelog.Close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -