/// <summary> /// 构造函数 /// </summary> /// <param name="element">配置节对象</param> /// <remarks> /// 根据配置信息,创建TextLogFormatter对象 /// <code source="..\Framework\TestProjects\DeluxeWorks.Library.Test\\Logging\FormatterTest.cs" /// lang="cs" region="Get Formatter Test" tittle="获取Formatter对象"></code> /// </remarks> public TextLogFormatter(LoggerFormatterConfigurationElement element) : base(element.Name) { this.template = element.Template; if (this.template.IsNullOrEmpty()) { this.template = Resource.DefaultTextFormat; } RegisterTokenFunctions(); }
public static ILogFormatter GetFormatter(LoggerFormatterConfigurationElement formatterElement) { if (formatterElement != null) { try { return((ILogFormatter)TypeCreator.CreateInstance(formatterElement.Type, formatterElement)); } catch (Exception ex) { throw new LogException("创建Formatter对象时出错:" + ex.Message, ex); } } else { return(null); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="element">配置节对象</param> /// <remarks> /// 根据配置信息,创建TextLogFormatter对象 /// <code source="..\Framework\TestProjects\DeluxeWorks.Library.Test\\Logging\FormatterTest.cs" /// lang="cs" region="Get Formatter Test" tittle="获取Formatter对象"></code> /// </remarks> public XmlLogFormatter(LoggerFormatterConfigurationElement element) : base(element.Name) { }