Пример #1
0
        public void ConstructLineTest()
        {
            ILogConstructor target = CreateLogConstructor(); // TODO: Initialize to an appropriate value
            Exception       ex     = null;

            try
            {
                throw new Exception(exception);
            }
            catch (Exception ex1)
            {
                ex = ex1;
            }

            LogItem item = new LogItem(category, level, message, ids, ex);

            LogLevel.SetLevel(LogLevel.Error, "Error");

            string        actual;
            StringBuilder sb = new StringBuilder();

            target.ConstructLine(sb, item);
            actual = sb.ToString();
            Assert.IsTrue(stringCriteria(actual));
        }
Пример #2
0
        public void Write(LogItem message)
        {
            TimeSpan elapsed = (DateTime.Now - lastFlush);

            constructor.ConstructLine(buffer, message);
            if (buffer.Length >= BufferSize ||
                elapsed > forceFlush)
            {
                Flush();
            }
        }