using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using static Common.CommonBase;
namespace Common
{
public class Logger
{
public LoggerMode loggerMode { get; set; } = LoggerMode.INFO;
public string LoggerLine { get; set; } = string.Empty;
}
public class LoggerQueueHelper
{
private LoggerQueueHelper()
{
}
private static string _LogPath;
public static string LogPath
{
get
{
if (MemoryCacheHelper.Contains("LogPath") == false)
{
DateTimeOffset thisOffsetTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,23,59,59);
string logPath = Path.GetFullPath("./");
MemoryCacheHelper.Set("LogPath", logPath, thisOffsetTime);
string path1 = logPath;
if (!Directory.Exists(path1))
{
Directory.CreateDirectory(path1);
}
_LogPath = logPath;
}
else
{
_LogPath = MemoryCacheHelper.GetCacheItem<string>("LogPath");
}
return _LogPath;
}
}
#region
private static object lockObj1 = new object();
private static void Log(Logger logger)
{
lock (lockObj1)
{
string filePath = Path.Combine(LogPath, "log");
str