Ejemplo n.º 1
0
        public void FileOutput()
        {
            using (AsyncLOGInstance instance = new AsyncLOGInstance(true, SyncType.EventWaitHandle, false, new[] { new FileOutputter(_outputFile) }, new [] { new KeyValuePair <string, string>("SessionID", "TestSession") }))
            {
                _testingAdditionalfields.Add("SessionID", "TestSession");
                instance.Debug("TestCase1");
            }

            using (StreamReader sr = new StreamReader(_outputFile.OpenRead()))
            {
                string content = sr.ReadToEnd();
                Assert.AreEqual(2, content.Split('\n').Length);
            }

            using (AsyncLOGInstance instance = new AsyncLOGInstance(true, SyncType.EventWaitHandle, false, new[] { new FileOutputter(_outputFile) }, new[] { new KeyValuePair <string, string>("SessionID", "TestSession") }))
            {
                instance.Debug("TestCase2");
            }

            using (StreamReader sr = new StreamReader(_outputFile.OpenRead()))
            {
                string content = sr.ReadToEnd();
                Assert.AreEqual(3, content.Split('\n').Length);
            }
        }
Ejemplo n.º 2
0
        public void Trace()
        {
            using (ILOGInstance instance = new AsyncLOGInstance(true, SyncType.EventWaitHandle, true, new[] { new TestOutputter() }, new[] { new KeyValuePair <string, string>("SessionID", "TestSession") }))
            {
                _testingAdditionalfields.Add("SessionID", "TestSession");

                _testingMessage  = "test Trace message";
                _testingTag      = "Trace";
                _testingSeverity = LogSeverity.Trace;
                instance.Trace(_testingMessage, _testingTag);
                LOG.Trace(_testingMessage, _testingTag);
            }
        }
Ejemplo n.º 3
0
        public void LogBridge()
        {
            using (ILOGInstance parent = new LOGInstance(false, new[] { new TestOutputter() }, new[] { new KeyValuePair <string, string>("SessionID", "TestSession Parent") }))
            {
                using (ILOGInstance child = new AsyncLOGInstance(true, SyncType.EventWaitHandle, false, new[] { new LOGBridgeOutputter(parent) }, new [] { new KeyValuePair <string, string>("testKey1", "TestSession Child") }))
                {
                    _testingMessage  = "test message info";
                    _testingTag      = "testTag";
                    _testingSeverity = LogSeverity.Info;

                    _testingAdditionalfields.Add("SessionID", "TestSession Parent");
                    _testingAdditionalfields.Add("testKey1", "TestSession Child");

                    child.Info(_testingMessage, _testingTag);
                }
            }
        }