/// <summary>
        /// Initializes a new instance of the <see cref="SumoLogicTargetTest"/> class.
        /// </summary>
        public SumoLogicTargetTest()
        {
            this.messagesHandler = new MockHttpMessageHandler();
            this.sumoLogicTarget = new SumoLogicTarget(null, this.messagesHandler);
            this.sumoLogicTarget.Url = "http://www.fakeadress.com";
            this.sumoLogicTarget.Layout = @"${level:upperCase=true}: ${message}";
            this.sumoLogicTarget.SourceName = "SumoLogicTargetTest";
            this.sumoLogicTarget.Name = "SumoLogicTargetTest";
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            LogManager.Configuration.AddTarget(this.sumoLogicTarget.SourceName, this.sumoLogicTarget);
            LoggingRule rule = new LoggingRule("SumoLogicTargetTest", LogLevel.Debug, this.sumoLogicTarget);
            LogManager.Configuration.LoggingRules.Add(rule);
            LogManager.Configuration.Reload();
            LogManager.ReconfigExistingLoggers();
            this.logger = LogManager.GetLogger("SumoLogicTargetTest");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SumoLogicTargetTest"/> class.
        /// </summary>
        public SumoLogicTargetTest()
        {
            this.messagesHandler            = new MockHttpMessageHandler();
            this.sumoLogicTarget            = new SumoLogicTarget(null, this.messagesHandler);
            this.sumoLogicTarget.Url        = "http://www.fakeadress.com";
            this.sumoLogicTarget.Layout     = @"${level:upperCase=true}: ${message}";
            this.sumoLogicTarget.SourceName = "SumoLogicTargetTest";
            this.sumoLogicTarget.Name       = "SumoLogicTargetTest";
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            LogManager.Configuration.AddTarget(this.sumoLogicTarget.SourceName, this.sumoLogicTarget);
            LoggingRule rule = new LoggingRule("SumoLogicTargetTest", LogLevel.Debug, this.sumoLogicTarget);

            LogManager.Configuration.LoggingRules.Add(rule);
            LogManager.Configuration.Reload();
            LogManager.ReconfigExistingLoggers();
            this.logger = LogManager.GetLogger("SumoLogicTargetTest");
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SumoLogicTargetTest"/> class.
        /// </summary>
        public SumoLogicTargetTest()
        {
            messagesHandler                = new MockHttpMessageHandler();
            sumoLogicTarget                = new SumoLogicTarget(null, messagesHandler);
            sumoLogicTarget.Url            = "http://www.fakeadress.com";
            sumoLogicTarget.Layout         = @"${level:upperCase=true}: ${message}${exception:format=tostring}${newline}";
            sumoLogicTarget.SourceName     = "SumoLogicTargetTest";
            sumoLogicTarget.SourceCategory = "SumoLogicTargetSourceCategory";
            sumoLogicTarget.SourceHost     = "${machinename}";
            sumoLogicTarget.Name           = "SumoLogicTargetTest";
            if (LogManager.Configuration == null)
            {
                LogManager.Configuration = new LoggingConfiguration();
            }

            LogManager.Configuration.AddTarget(sumoLogicTarget.SourceName, sumoLogicTarget);
            LoggingRule rule = new LoggingRule("SumoLogicTargetTest", LogLevel.Debug, sumoLogicTarget);

            LogManager.Configuration.LoggingRules.Add(rule);
            LogManager.Configuration.Reload();
            LogManager.ReconfigExistingLoggers();
            logger = LogManager.GetLogger("SumoLogicTargetTest");
        }