Refactoring, added more logging, minor command structure change.

This commit is contained in:
2020-07-05 23:32:03 -05:00
parent 63a31c491d
commit b2a47ebefc
5 changed files with 43 additions and 37 deletions

View File

@@ -4,21 +4,21 @@ using SlatedGameToolkit.Tools.CommandSystem.Interaction;
namespace SlatedGameToolkit.Tools.Utilities.Playground
{
public class ConsoleLogListener : ILogListener
public class ConsolePlaygroundListener : ILogListener
{
public bool Debug { get; set; }
public LogLevel Level => Debug ? LogLevel.DEBUG : LogLevel.INFO;
private ConsoleInteraction interaction;
public ConsoleLogListener(ConsoleInteraction interaction = null) {
public ConsolePlaygroundListener(ConsoleInteraction interaction = null) {
this.interaction = interaction;
}
public void LogMesesage(string message, DateTime time, LogLevel level)
{
Console.SetCursorPosition(0, Console.CursorTop);
Console.WriteLine(string.Format("Playground [{0}] [{1}]: {2}", level, time.ToString("H:mm:ss"), message));
Console.WriteLine(string.Format("Engine [{0}] [{1}]: {2}", level, time.ToString("H:mm:ss"), message));
if (interaction != null && interaction.Listening) {
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write(interaction.Prefix + "> ");