Beispiel #1
0
    [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)");
    }
Beispiel #2
0
    [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);
Beispiel #5
0
    [Test] public void TraceDecoratorWithReason()
    {
        var t = new T(new Cooldown(), next: null, reason: "[5] Steer");

        o(F.LogTrace(t), "<C> [5] Steer");
    }
Beispiel #6
0
    [Test] public void TraceWithReasonAndFormatArgs()
    {
        var t = new T("SetPos", next: null, reason: "Teleport here");

        o(F.LogTrace(t), "SetPos (Teleport here)");
    }
Beispiel #7
0
    [Test] public void TraceWithReason()
    {
        var t = new T("SetPos", next: null, reason: "Teleport");

        o(F.LogTrace(t), "SetPos (Teleport)");
    }
Beispiel #8
0
    [Test] public void LogTrace()
    {
        var t = new T("SetPos", next: null, reason: null);

        o(F.LogTrace(t), "SetPos");
    }
Beispiel #9
0
 [Test] public void BadReason()
 {
     Assert.Throws <ArgEx>(() => F.ReasonField("(parens)"));
 }
Beispiel #10
0
 [Test] public void ReasonField()
 {
     o(F.ReasonField(null), null);
     o(F.ReasonField(""), null);
     o(F.ReasonField("Foo"), "Foo");
 }
Beispiel #11
0
 [Test] public void LogTrace_null()
 {
     o(F.LogTrace(null), "?trace");
 }