using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
namespace MoonExp.cs
{
///
/// 日志输出类
///
public class LogOut
{
///
/// 日志
///
protected static readonly log4net.ILog _log;
///
/// 静态构造函数
///
static LogOut()
{
try
{
_log = log4net.LogManager.GetLogger("log4net");
//HttpContext.Current.Request.PhysicalApplicationPath
string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Sources\\Log.config");
log4net.Config.XmlConfigurator.Configure(new FileInfo(fileName));
}
catch
{
}
}
///
/// 调试
///
/// 日志
public static void Debug(string message)
{
try
{
if (_log.IsDebugEnabled)
{
_log.Debug("调试:" + message + "\r\n\r\n");
}
}
catch
{
}
}
///
/// 信息
///
/// 日志
public static void Info(string message)
{
try
{
if (_log.IsInfoEnabled)
{
_log.Info("信息:" + message + "\r\n\r\n");
}
}
catch
{
}
}
///
/// 警告
///
/// 日志
public static void Warn(string message)
{
try
{
if (_log.IsWarnEnabled)
{
_log.Warn("警告:" + message + "\r\n\r\n");
}
}
catch
{
}
}
///
/// 错误
///
/// 日志
public static void Error(string message)
{
try
{
if (_log.IsErrorEnabled)
{
_log.Error("错误:" + message + "\r\n\r\n");
}
}
catch
{
}
}
///
/// 致命
///
/// 日志
public static void Fatal(string message)
{
try
{
if (_log.IsFatalEnabled)
{
_log.Fatal("致命:" + message + "\r\n\r\n");
}
}
catch
{
}
}
}
}