using log4net; using System; namespace Util { public class LogUtil { /// /// 默认log实例 /// private static ILog LOG = LogManager.GetLogger("Console"); /// /// 默认控制台logger debug /// /// 输出内容 public static void Debug(string message) { LOG.Debug(message); } /// /// 默认控制台logger debug /// /// 输出内容 /// 异常堆栈 public static void Debug(string message, Exception exception) { LOG.Debug(message, exception); } /// /// 默认控制台logger info /// /// public static void Info(string message) { LOG.Info(message); } /// /// 默认控制台logger info /// /// 输出内容 /// 异常堆栈 public static void Info(string message, Exception exception) { LOG.Info(message, exception); } /// /// 默认控制台logger warn /// /// 输出内容 public static void Warn(string message) { LOG.Warn(message); } /// /// 默认控制台logger warn /// /// 输出内容 /// 异常堆栈 public static void Warn(string message, Exception exception) { LOG.Warn(message, exception); } /// /// 默认控制台logger error /// /// 输出内容 public static void Error(string message) { LOG.Error(message); } /// /// 默认控制台logger error /// /// 输出内容 /// 异常堆栈 public static void Error(string message, Exception exception) { LOG.Error(message, exception); } /// /// 默认控制台logger fatal /// /// 输出内容 public static void Fatal(string message) { LOG.Fatal(message); } /// /// 默认控制台logger fatal /// /// 输出内容 /// 异常堆栈 public static void Fatal(string message, Exception exception) { LOG.Fatal(message, exception); } /// /// 获取指定的logger /// /// /// public static ILog GetLogger(string loggerNmae) { return LogManager.GetLogger(loggerNmae); } } }