public LogEntry(LogEntryImportance importance, DateTime dateTime, string colleague, string message) { DateTime = dateTime; Colleague = colleague; Message = message; Importance = importance.ToString(); ThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId; }
public void WriteLog( string message, GameEntity playerEntity, GameManager manager, LogEntryImportance importance = LogEntryImportance.Default) { if (message == null) { return; } var entry = new LogEntry { Id = ++manager.Game.NextLogId, Message = message, PlayerId = playerEntity.Id, Tick = manager.Game.CurrentTick, Importance = importance }; playerEntity.Player.LogEntries.Add(entry); }
protected void Log(LogEntryImportance importance, string message, bool logToConsole = false) { //log to dynamic log viewer if (logToConsole) { Mediator.NotifyColleagues <LogEntry>(MediatorMessages.LogMessage, new LogEntry(importance, DateTime.UtcNow, _name, message)); } //log to file switch (importance) { case LogEntryImportance.Info: _logger.Info(message); break; case LogEntryImportance.Debug: _logger.Debug(message); break; case LogEntryImportance.Error: _logger.Error(message); break; } }