Skip to content

Commit

Permalink
Logger: Log from animation start time
Browse files Browse the repository at this point in the history
  • Loading branch information
acidbubbles committed Oct 1, 2021
1 parent 35e536b commit 42341d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/AtomAnimations/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Logger
public Regex filter { get; set; }

private readonly Atom _containingAtom;
private float _startTime = Time.time;

public Logger(Atom containingAtom)
{
Expand All @@ -31,12 +32,13 @@ public Logger(Atom containingAtom)
public void Begin()
{
if(clearOnPlay) SuperController.singleton.ClearMessages();
_startTime = Time.time;
}

public void Log(string category, string message)
{
if (filter != null && !filter.IsMatch(message)) return;
SuperController.LogMessage($"[{Time.time % 100:00.000}|{_containingAtom.name}|{category}] {message}");
SuperController.LogMessage($"[{(Time.time - _startTime) % 100:00.000}|{_containingAtom.name}|{category}] {message}");
}
}
}

0 comments on commit 42341d5

Please sign in to comment.