RM.Common/DotNetCode/LogHelper.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using RM.Common.DotNetConfig;
using System;
using System.IO;
namespace RM.Common.DotNetCode
{
public class LogHelper : IDisposable
{
private string LogFile;
private static StreamWriter sw;
private string logIsWrite = ConfigHelper.GetAppSettings("LogIsWrite");
public LogHelper()
{
this.CreateLoggerFile(null);
}
public LogHelper(string _log)
{
this.CreateLoggerFile(_log);
}
private void CreateLoggerFile(string fileName)
{
if (this.logIsWrite == "true")
{
if (string.IsNullOrEmpty(fileName))
{
fileName = DateTimeHelper.GetToday();
}
object _myLogPath = null;
if (_myLogPath == null)
{
this.LogFile = ConfigHelper.GetAppSettings("LogFilePath");
if (File.Exists(this.LogFile))
{
Directory.CreateDirectory(this.LogFile);
}
}
else
{
this.LogFile = _myLogPath.ToString();
}
if (1 > this.LogFile.Length)
{
Console.WriteLine("配置文件中没有指定日志文件目录!");
}
else
{
if (!Directory.Exists(this.LogFile))
{
Console.WriteLine("配置文件中指定日志文件目录不存在!");
}
else
{
if (this.LogFile.Substring(this.LogFile.Length - 1, 1).Equals("/") || this.LogFile.Substring(this.LogFile.Length - 1, 1).Equals("\\"))
{
this.LogFile = this.LogFile + fileName + ".log";
}
else
后面还有 64 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
