Example #1
0
        public void logRecord_constructorPopulatesProcessNo()
        {
            logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, "");

            Process tempProcess = Process.GetCurrentProcess();

            Assert.AreEqual(tempProcess.Id, b.process);
        }
Example #2
0
 public override bool log(logRecord record)
 {
     if (this.getlevel() <= record.levelEnum)
     {
         this.logAction(this.formatter.format(record));
         return(true);
     }
     return(false);
 }
Example #3
0
        public void formatter_testDefaultConstructor()
        {
            string testMessage = "testLogger {0}, {1}";

            string[]  argsArray = new string[] { "test_args1", "test_args2" };
            formatter b         = new formatter();
            logRecord l         = new logRecord("formatter Test", loggerLevels.CRITICAL, testMessage, argsArray, "");

            Console.WriteLine(b.format(l));
            Assert.AreEqual(String.Format(testMessage, argsArray), b.format(l));
        }
Example #4
0
        public string format(logRecord record)
        {
            formatter fmt = null;

            if (this.formatter != null)
            {
                fmt = this.formatter;
            }
            else
            {
                fmt = _defaultFormatter;
            }

            return(fmt.format(record));
        }
Example #5
0
        public void formatter_properlyAddsLoggerName()
        {
            string testMessage = "testLogger {0}, {1}";

            string[]     argsArray  = new string[] { "test_args1", "test_args2" };
            loggerLevels testLevel  = loggerLevels.CRITICAL;
            string       loggerName = "formatter Test";

            formatter b = new formatter("{levelName}:{name}:{message}");
            logRecord l = new logRecord(loggerName, testLevel, testMessage, argsArray, "");

            string resultMessage = String.Format("{0}:{1}:{2}", testLevel, loggerName, String.Format(testMessage, argsArray));

            Console.WriteLine(b.format(l));
            Assert.AreEqual(resultMessage, b.format(l));
        }
Example #6
0
 public override void emit(logRecord record)
 {
     string msg = this.format(record);
 }
Example #7
0
 public abstract void emit(logRecord record);
Example #8
0
 public abstract bool log(logRecord record_in);
Example #9
0
        public void logRecord_constructorPopulatesLevelNo()
        {
            logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, "");

            Assert.AreEqual(50, b.levelNo);
        }
Example #10
0
        public void logRecord_constructorPopulatesMsecs()
        {
            logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, "");

            Assert.AreEqual(b.created.Millisecond, b.msecs);
        }
Example #11
0
        public void logRecord_constructorPopulatesCreated()
        {
            logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, "");

            Assert.IsNotNull(b.created);
        }