[Test] public void TraceWithReasonAndInner2() { var t0 = new T("SetPos", next: null, reason: "Teleport"); var t1 = new T("Reposition", next: t0, reason: null); o(F.LogTrace(t0), "SetPos (Teleport)"); o(F.LogTrace(t1), "Reposition -> SetPos (Teleport)"); }
[Test] public void Prefix() { var t = new T("SetPos", next: null, reason: null); t.Prefix('!'); o(F.LogTrace(t), "!SetPos"); t.Prefix('+'); o(F.LogTrace(t), "+!SetPos"); }
public LogTrace(object scope, LogTrace next, string reason) { if (!status.log) { throw new InvEx("Logging is disabled"); } this.scope = scope.ToString(); this.isDecorator = scope is IDecorator; this.next = next; this.reason = TraceFormat.ReasonField(reason); }
public bool Matches(object scope, string reason) => (this.scope?.ToString()).Equals(scope) && this.reason == TraceFormat.ReasonField(reason);
[Test] public void TraceDecoratorWithReason() { var t = new T(new Cooldown(), next: null, reason: "[5] Steer"); o(F.LogTrace(t), "<C> [5] Steer"); }
[Test] public void TraceWithReasonAndFormatArgs() { var t = new T("SetPos", next: null, reason: "Teleport here"); o(F.LogTrace(t), "SetPos (Teleport here)"); }
[Test] public void TraceWithReason() { var t = new T("SetPos", next: null, reason: "Teleport"); o(F.LogTrace(t), "SetPos (Teleport)"); }
[Test] public void LogTrace() { var t = new T("SetPos", next: null, reason: null); o(F.LogTrace(t), "SetPos"); }
[Test] public void BadReason() { Assert.Throws <ArgEx>(() => F.ReasonField("(parens)")); }
[Test] public void ReasonField() { o(F.ReasonField(null), null); o(F.ReasonField(""), null); o(F.ReasonField("Foo"), "Foo"); }
[Test] public void LogTrace_null() { o(F.LogTrace(null), "?trace"); }