Render() public method

Renders the the value of layout renderer in the context of the specified log event.
public Render ( LogEventInfo logEvent ) : string
logEvent LogEventInfo The log event.
return string
示例#1
0
 private static LayoutRenderer ConvertToLiteral(LayoutRenderer renderer)
 {
     return new LiteralLayoutRenderer(renderer.Render(LogEventInfo.CreateNullEvent()));
 }
        /// <summary>
        /// set in Session and test
        /// </summary>
        /// <param name="key">set with this key</param>
        /// <param name="value">set this value</param>
        /// <param name="expected">expected</param>
        /// <param name="appSettingLayoutRenderer"></param>
        /// <remarks>IRenderable is internal</remarks>
        private void ExecTest(string key, object value, object expected, LayoutRenderer appSettingLayoutRenderer)
        {
            Session[key] = value;

            var rendered = appSettingLayoutRenderer.Render(LogEventInfo.CreateNullEvent());

            Assert.Equal(expected, rendered);
        }
示例#3
0
文件: LayoutParser.cs 项目: ExM/NLog
 private static LayoutRenderer ConvertToLiteral(LoggingConfiguration cfg, LayoutRenderer renderer)
 {
     var closeReq = ObjectGraph.DeepInitialize(renderer, cfg, LogManager.ThrowExceptions);
     string text = renderer.Render(LogEventInfo.CreateNullEvent());
     foreach (var item in closeReq)
         item.Close();
     return new LiteralLayoutRenderer(text);
 }