示例#1
0
        /// <summary>Sets the output helper.</summary>
        /// <param name="value">The value.</param>
        /// <param name="minLogLevel"></param>
        /// <autogeneratedoc />
        /// TODO Edit XML Comment Template for SetOutputHelper
        public void SetOutputHelper(ITestOutputHelper value, NLog.LogLevel minLogLevel = null)
        {
            if (_xunitTarget != null)
            {
                AppLoggingConfigHelper.RemoveTarget(_xunitTarget);
                _xunitTarget.Dispose( );
            }

            if (value == null)
            {
                _xunitTarget = null;
                return;
            }

            _xunitTarget = new XunitTarget("Xunit")
            {
                OutputHelper = value
            };
            AppLoggingConfigHelper.AddTarget(_xunitTarget, minLogLevel);
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="System.Object" />
        ///     class.
        /// </summary>
        public GlobalLoggingFixture(IMessageSink sink)
        {
            AppLoggingConfigHelper.EnsureLoggingConfigured(
                message => sink.OnMessage(
                    new DiagnosticMessage(
                        message
                        )
                    )
                );

            var l = AppLoggingConfigHelper.SetupJsonLayout( );

            sink.OnMessage(
                new DiagnosticMessage("Constructing GlobalLoggingFixture.")
                );
            _xunitSinkTarget = new XunitSinkTarget("Xunitsink", sink)
            {
                Layout = l
            };
            AppLoggingConfigHelper.AddTarget(_xunitSinkTarget, null);
            Logger.Warn($"{nameof ( GlobalLoggingFixture)} logger added.");
        }