Very simple logger just spaming out all log events into the console. Used by default.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Core Logger
DeltaEngine.Core ConsoleLogger
Namespace: DeltaEngine.Core
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The ConsoleLogger type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ConsoleLogger | Initializes a new instance of the ConsoleLogger class |
Methods
Name | Description | |
---|---|---|
CreateMessageTypePrefix | (Inherited from Logger.) | |
Dispose | Releases all resources used by the ConsoleLogger (Overrides Logger Dispose .) | |
Write |
Write all messages to the console, but limit to 100 per second and 10 in debug mode as the
console is very slow and will cause the app to freeze if too many messages are processed.
View code on GitHub (Overrides Logger Write(Logger MessageType, String).) |
Properties
Name | Description | |
---|---|---|
DoNotSkipMessagesIfTooManyAreWrittenEachSecond | ||
LastMessage | (Inherited from Logger.) | |
NumberOfRepeatedMessagesIgnored | (Inherited from Logger.) |
Remarks
Examples
[Test] public void WriteInfo() { using (var logger = new ConsoleLogger()) { Assert.AreEqual("", console.ToString()); logger.Write(Logger.MessageType.Info, "Hello"); Assert.IsTrue(console.ToString().Contains("Hello"), console.ToString()); } }
[Test] public void LogWarning() { using (var logger = new ConsoleLogger()) { Assert.AreEqual("", console.ToString()); logger.Write(Logger.MessageType.Warning, "Ohoh"); Assert.IsTrue(console.ToString().Contains("Warning: Ohoh"), console.ToString()); logger.Write(Logger.MessageType.Warning, new NullReferenceException().ToString()); Assert.IsTrue(console.ToString().Contains("NullReferenceException"), console.ToString()); } }
[Test] public void LogError() { using (var logger = new ConsoleLogger()) { Assert.AreEqual("", console.ToString()); logger.Write(Logger.MessageType.Error, new NotSupportedException().ToString()); Assert.IsTrue(console.ToString().Contains("NotSupportedException"), console.ToString()); } }
See Also