Adds the specified log entry. The log entry description.
(ref LogEntryDescription desc)
| 461 | /// </summary> |
| 462 | /// <param name="desc">The log entry description.</param> |
| 463 | public void Add(ref LogEntryDescription desc) |
| 464 | { |
| 465 | if (_entriesPanel == null) |
| 466 | return; |
| 467 | |
| 468 | // Create new entry |
| 469 | switch (_timestampsFormats) |
| 470 | { |
| 471 | case InterfaceOptions.TimestampsFormats.Utc: desc.Title = $"[{DateTime.UtcNow}] {desc.Title}"; break; |
| 472 | case InterfaceOptions.TimestampsFormats.LocalTime: desc.Title = $"[{DateTime.Now}] {desc.Title}"; break; |
| 473 | case InterfaceOptions.TimestampsFormats.TimeSinceStartup: desc.Title = string.Format("[{0:g}] ", TimeSpan.FromSeconds(Time.TimeSinceStartup)) + desc.Title; break; |
| 474 | } |
| 475 | var newEntry = new LogEntry(this, ref desc); |
| 476 | |
| 477 | // Enqueue |
| 478 | lock (_locker) |
| 479 | { |
| 480 | _pendingEntries.Add(newEntry); |
| 481 | } |
| 482 | |
| 483 | if (newEntry.Group == LogGroup.Warning && _iconType < LogType.Warning) |
| 484 | { |
| 485 | _iconType = LogType.Warning; |
| 486 | UpdateIcon(); |
| 487 | } |
| 488 | |
| 489 | if (newEntry.Group == LogGroup.Error && _iconType < LogType.Error) |
| 490 | { |
| 491 | _iconType = LogType.Error; |
| 492 | UpdateIcon(); |
| 493 | } |
| 494 | |
| 495 | // Pause on Error (we should do it as fast as possible) |
| 496 | if (newEntry.Group == LogGroup.Error && _pauseOnErrorButton.Checked && Editor.StateMachine.CurrentState == Editor.StateMachine.PlayingState) |
| 497 | { |
| 498 | Editor.Log("Pause Play mode on error (toggle this behaviour in the Debug Log panel)"); |
| 499 | Editor.Simulation.RequestPausePlay(); |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | /// <summary> |
| 504 | /// Gets or sets the selected entry. |
no test coverage detected