1)首先LoggerEnum.cs 类型枚举
namespace ICUValidationService.Log
{
public enum LogType
{
All,
Information,
Debug,
Success,
Failure,
Warning,
Error
}
}
2)Logger.cs
using System;
using System.IO;
using System.Reflection;
namespace ICUValidationService.Log
{
public class Logger
{
#region Instance
private static object logLock;
private static Logger _instance;
private static string logFileName;
private Logger() { }
/// <summary>
/// Logger instance
/// </summary>
public static Logger Instance
{
get
{
if (_instance == null)
{
_instance = new Logger();
logLock = new object();
logFileName = DateTime.Now.ToString("hh_mm_ss"