Skip to content

Commit 21f65e4

Browse files
committed
Prep for attaching debug info to message
1 parent 1752787 commit 21f65e4

File tree

5 files changed

+60
-2
lines changed

5 files changed

+60
-2
lines changed

Runtime/DebugChan/DebugChan.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
using S = System.String;
2+
using P = System.Runtime.CompilerServices.CallerFilePathAttribute;
3+
using M = System.Runtime.CompilerServices.CallerMemberNameAttribute;
4+
using L = System.Runtime.CompilerServices.CallerLineNumberAttribute;
15
using UnityEngine;
26
using Activ.Loggr; using Activ.LogChan;
37

@@ -8,8 +12,14 @@ public static class DebugChan{
812

913
public static Logger<string, object> logger;
1014

11-
public static void Print(string arg, object source){
12-
logger?.Log(arg, RemapSource(source), maxMessages);
15+
public static void Print(
16+
string arg, object source,
17+
[P] S path="", [M] S member="", [L] int line=0)
18+
{
19+
logger?.Log(
20+
arg,
21+
//new DebugInfo(path, member, line),
22+
RemapSource(source), maxMessages);
1323
if(logToConsole)
1424
Debug.Log(arg, source as UnityEngine.Object);
1525
}

Runtime/DebugChan/LogInfo.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Activ.Loggr{
2+
public readonly struct LogInfo{
3+
4+
readonly string path, member;
5+
readonly int line;
6+
7+
public LogInfo(string path, string member, int line){
8+
this.path = path;
9+
this.member = member;
10+
this.line = line;
11+
}
12+
13+
}}

Runtime/DebugChan/LogInfo.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/DebugChan/LogMessage.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Activ.Loggr{
2+
public readonly struct LogMessage{
3+
4+
readonly string message;
5+
readonly LogInfo info;
6+
7+
public LogMessage(string message,
8+
string path, string member, int line){
9+
this.message = message;
10+
this.info = new LogInfo(path, member, line);
11+
}
12+
13+
}}

Runtime/DebugChan/LogMessage.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)