public void logRecord_constructorPopulatesProcessNo() { logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, ""); Process tempProcess = Process.GetCurrentProcess(); Assert.AreEqual(tempProcess.Id, b.process); }
public override bool log(logRecord record) { if (this.getlevel() <= record.levelEnum) { this.logAction(this.formatter.format(record)); return(true); } return(false); }
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)); }
public string format(logRecord record) { formatter fmt = null; if (this.formatter != null) { fmt = this.formatter; } else { fmt = _defaultFormatter; } return(fmt.format(record)); }
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)); }
public override void emit(logRecord record) { string msg = this.format(record); }
public abstract void emit(logRecord record);
public abstract bool log(logRecord record_in);
public void logRecord_constructorPopulatesLevelNo() { logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, ""); Assert.AreEqual(50, b.levelNo); }
public void logRecord_constructorPopulatesMsecs() { logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, ""); Assert.AreEqual(b.created.Millisecond, b.msecs); }
public void logRecord_constructorPopulatesCreated() { logRecord b = new logRecord("test", loggerLevels.CRITICAL, "", argsTest, ""); Assert.IsNotNull(b.created); }