using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DeiNiu.Utils { public class LogHelper { static log4net.ILog log =log4net.LogManager.GetLogger("wms"); /// /// 输出日志到Log4Net /// /// /// #region static void WriteLog(Type t, Exception ex) public static void WriteLog(Type t, Exception ex) { // log4net.ILog log = log4net.LogManager.GetLogger(t); log.Error(getMsg(t.ToString(), ex.StackTrace), ex); } #endregion /// /// 输出日志到Log4Net /// /// /// #region static void WriteLog(Type t, string msg) public static void WriteLog(Type t, string msg) { // log4net.ILog log = log4net.LogManager.GetLogger(t); log.Error(getMsg(t.ToString(), msg)); } public static void debug(string className, string msg) { // log4net.ILog log = log4net.LogManager.GetLogger(className); log.Debug(getMsg(className, msg)); } public static void debug(Type t, string msg) { // log4net.ILog log = log4net.LogManager.GetLogger(t); log.Debug(getMsg(t.ToString(),msg)); } public static void info(string className, string msg) { // log4net.ILog log = log4net.LogManager.GetLogger(className); log.Info(getMsg(className,msg)); } static string getMsg(string className, string msg) { return string.Format("{0} -----{1}",className,msg); } #endregion } }