A Log output that stores all log entries in memory.
Inheritance: ILogOutput
Exemple #1
0
        static Log()
        {
            SharedState state = new SharedState();

            data      = new DataLogOutput();
            logGame   = new Log("Game", state, data);
            logCore   = new Log("Core", state, data);
            logEditor = new Log("Edit", state, data);

            bool hasConsole = true;

            try
            {
                int doesThisThrow = Console.WindowHeight;
            }
            catch (Exception)
            {
                hasConsole = false;
            }
            if (System.Diagnostics.Debugger.IsAttached || hasConsole)
            {
                logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray));
                logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue));
                logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta));
            }
        }
		static Log()
		{
			SharedState state = new SharedState();
			data = new DataLogOutput();
			logGame = new Log("Game", state, new ConsoleLogOutput(ConsoleColor.DarkGray), data);
			logCore = new Log("Core", state, new ConsoleLogOutput(ConsoleColor.DarkBlue), data);
			logEditor = new Log("Edit", state, new ConsoleLogOutput(ConsoleColor.DarkMagenta), data);
		}
Exemple #3
0
		static Log()
		{
			SharedState state = new SharedState();
			data = new DataLogOutput();

			logGame		= new Log("Game", state, data);
			logCore		= new Log("Core", state, data);
			logEditor	= new Log("Edit", state, data);
		}
Exemple #4
0
        static Log()
        {
            SharedState state = new SharedState();

            data = new DataLogOutput();

            logGame   = new Log("Game", state, data);
            logCore   = new Log("Core", state, data);
            logEditor = new Log("Edit", state, data);
        }
Exemple #5
0
        static Log()
        {
            SharedState state = new SharedState();

            data = new DataLogOutput();

            logGame   = new Log("Game", state, data);
            logCore   = new Log("Core", state, data);
            logEditor = new Log("Edit", state, data);

            logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray));
            logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue));
            logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta));
        }
Exemple #6
0
		static Log()
		{
			SharedState state = new SharedState();
			data = new DataLogOutput();
			logGame		= new Log("Game", state, data);
			logCore		= new Log("Core", state, data);
			logEditor	= new Log("Edit", state, data);

			bool hasConsole = true;
			try
			{
				int doesThisThrow = Console.WindowHeight;
			}
			catch (Exception)
			{
				hasConsole = false;
			}
			if (System.Diagnostics.Debugger.IsAttached || hasConsole)
			{
				logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray));
				logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue));
				logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta));
			}
		}
Exemple #7
0
			public ViewEntry(DataLogOutput.LogEntry log)
			{
				this.log = log;
			}
Exemple #8
0
		private void boundOutput_NewEntry(object sender, DataLogOutput.LogEntryEventArgs e)
		{
			lock (this.logSchedule)
			{
				this.logSchedule.Add(e.Entry);
			}
			if (!this.timerLogSchedule.Enabled)
			{
				// Don't use a synchronous Invoke. It will block while the BuildManager is active (why?)
				// and thus lead to a deadlock when something is logged while it is.
				this.InvokeEx(() => this.timerLogSchedule.Enabled = true, false);
			}
		}
Exemple #9
0
		public void BindToOutput(DataLogOutput dualityLog)
		{
			if (this.boundOutput == dualityLog) return;

			if (this.boundOutput != null)
				this.boundOutput.NewEntry -= this.boundOutput_NewEntry;

			this.boundOutput = dualityLog;
			this.UpdateFromLog(this.boundOutput);

			if (this.boundOutput != null)
				this.boundOutput.NewEntry += this.boundOutput_NewEntry;
		}
Exemple #10
0
		public void UpdateFromLog(DataLogOutput dualityLog)
		{
			if (dualityLog == null)
			{
				this.Clear();
				return;
			}

			this.entryList.Clear();
			foreach (var entry in dualityLog.Data)
				this.entryList.Add(new ViewEntry(entry));

			this.OnContentChanged();
		}
Exemple #11
0
		public ViewEntry AddEntry(DataLogOutput.LogEntry entry)
		{
			ViewEntry viewEntry = new ViewEntry(entry);
			this.entryList.Add(viewEntry);

			if (this.NewEntry != null)
				this.NewEntry(this, new ViewEntryEventArgs(viewEntry));

			this.OnContentChanged();
			return viewEntry;
		}
Exemple #12
0
		public ViewEntry GetViewEntry(DataLogOutput.LogEntry entry)
		{
			return this.entryList.FirstOrDefault(e => e.LogEntry == entry);
		}
		private void LogData_NewEntry(object sender, DataLogOutput.LogEntryEventArgs e)
		{
			if (this.InvokeRequired) return;
			bool pause = 
				e.Entry.Type == LogMessageType.Error && 
				this.buttonPauseOnError.Checked && 
				Sandbox.State == SandboxState.Playing && 
				!Sandbox.IsChangingState;
			if (pause)
			{
				System.Media.SystemSounds.Hand.Play();
				Sandbox.Pause();
			}
		}
Exemple #14
0
			public ViewEntry(LogEntryList parent, DataLogOutput.LogEntry log)
			{
				this.parent = parent;
				this.log = log;
				this.msgLines = log.Message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).Length;
			}