| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using log4net;
- using System;
- [assembly: log4net.Config.XmlConfigurator(Watch = true)]
- namespace Muchinfo.PC.Common.Helpers
- {
- public class LogHelper
- {
- // private static Window1 window = null;
- /// <summary>
- /// 写错误日志
- /// </summary>
- /// <param name="message">The message.</param>
- public static void WriteError(Type t, string message)
- {
- //避免写日志循环
- try
- {
- var log = LogManager.GetLogger(t);
- if (log.IsErrorEnabled)
- {
- log.Error(message);
- }
- }
- catch
- {
- }
- }
- /// <summary>
- /// 写信息日志
- /// </summary>
- /// <param name="message">The message.</param>
- public static void WriteInfo(string message)
- {
- //避免写日志循环
- try
- {
- var log = LogManager.GetLogger(typeof(LogHelper));
- if (log.IsInfoEnabled)
- {
- log.Info(message);
- }
- }
- catch
- {
- }
- }
- }
- }
|