1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Xml;
- namespace PacsView3D
- {
- public class Log4NetHelper
- {
- private static Dictionary<string, log4net.ILog> m_lstLog = new Dictionary<string, log4net.ILog>();
- public static void InitLog4Net(string strLog4NetConfigFile)
- {
- log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(strLog4NetConfigFile));
- }
- public static readonly log4net.ILog logInfo = log4net.LogManager.GetLogger("loginfo");
- public static readonly log4net.ILog logError = log4net.LogManager.GetLogger("logerror");
- public static readonly log4net.ILog logDebug = log4net.LogManager.GetLogger("logdebug");
- public static void WriteLog(string info)
- {
- if (logInfo.IsInfoEnabled)
- {
- logInfo.Info(info);
- }
- }
- public static void WriteLog(string info, Exception ex)
- {
- if (logError.IsErrorEnabled)
- {
- logError.Error(info, ex);
- }
- }
- public static void WriteLogDebug(string info, Exception ex)
- {
- if (logDebug.IsDebugEnabled)
- {
- logDebug.Debug(info, ex);
- }
- }
- }
- }
|