MsgLog.cs
来源:互联网 发布:甜甜圈拷机软件 编辑:程序博客网 时间:2024/05/16 23:33
using System;using System.IO;using System.Text;namespace Common{ public static class MsgLog { #region 公共变量 public static string Path { get; set; } #endregion #region 公共函数 public static void ClearLog() { if (File.Exists(Path)) File.Delete(Path); } public static void Log(object message) { var fs = getFile(Path, FileMode.Append); var buff = Encoding.UTF8.GetBytes(message + "\r\n"); fs.Write(buff, 0, buff.Length); fs.Close(); } #endregion #region 私有函数 static FileStream getFile(string filePath, FileMode mode) { var path = filePath.Substring(0, filePath.LastIndexOf("/", StringComparison.Ordinal)); if (!Directory.Exists(path)) Directory.CreateDirectory(path); var file = !File.Exists(filePath) ? new FileStream(filePath, FileMode.Create) : new FileStream(filePath, mode); return file; } #endregion }}
阅读全文
0 0
- MsgLog.cs
- RMAN-00557: 无法打开 MSGLOG
- CS..........................
- cs
- cs
- cs
- Cs
- cs
- cs
- cs
- CS
- cs
- cs,
- cs
- cs
- cs
- cs
- cs
- Vue之Vue.set动态新增对象属性
- Mac brew命令
- codeforces 814C An impassioned circulation of affection 尺取法或者预处理
- HADOOP1.X中HDFS工作原理
- 动态添加javascript并判断是否加载完成
- MsgLog.cs
- JAVA的基础语法了解
- codeforces 814B An express train to reveries
- 简单的推箱子游戏的实现
- Maven 学习(一)
- Maven 学习(二)
- 使用Gradle构建SpringBoot工程系列:第一篇:Gradle及SpringBoot简介
- 将博客搬至CSDN
- RPC: 使用xml-xpc实现进程间的rpc调用试验和结论