NLog.Layouts.SimpleLayout.InitializeLayout C# (CSharp) Method

InitializeLayout() protected method

Initializes the layout.
protected InitializeLayout ( ) : void
return void
        protected override void InitializeLayout()
        {
            for (int i = 0; i < this.Renderers.Count; i++)
            {
                LayoutRenderer renderer = this.Renderers[i];
                try
                {
                    renderer.Initialize(LoggingConfiguration);
                }
                catch (Exception exception)
                {
                    //also check IsErrorEnabled, otherwise 'MustBeRethrown' writes it to Error

                    //check for performance
                    if (InternalLogger.IsWarnEnabled || InternalLogger.IsErrorEnabled)
                    {
                        InternalLogger.Warn(exception, "Exception in '{0}.InitializeLayout()'", renderer.GetType().FullName);
                    }

                    if (exception.MustBeRethrown())
                    {
                        throw;
                    }
                }
            }

            base.InitializeLayout();
        }