예제 #1
0
        public void GetPatternForLogTest()
        {
            LogPattern pattern1 = PatternManager.GetPatternForLog("DiscoveryEngine.log");
            LogPattern pattern2 = PatternManager.GetPatternForLog("DiscoveryEngine.log.1");

            Assert.AreEqual("DiscoveryEngine.log*", pattern2.FileMask);
            Assert.AreEqual(pattern1.FileMask, pattern2.FileMask);

            pattern1 = PatternManager.GetPatternForLog("Debug.log");
            Assert.AreEqual("Debug.log", pattern1.FileMask);

            pattern1 = PatternManager.GetPatternForLog("swDebug.log");
            Assert.AreEqual("*", pattern1.FileMask);

            //Test default parser
            pattern1 = PatternManager.GetPatternForLog("SomethingWhatShouldntExistsInParserDefinition-XYZ_BlaBlaBla");

            Assert.AreEqual("*", pattern1.FileMask);
            Assert.AreEqual(true, pattern1.ContainsClass);
            Assert.AreEqual(true, pattern1.ContainsThread);
            Assert.AreEqual(true, pattern1.ContainsType);
            Assert.AreEqual("yyyy-MM-dd HH:mm:ss,fff", pattern1.DateTimeFormat);
        }