Skip to content

Commit d7e919e

Browse files
authored
Merge pull request #33 from eelstork/dev
Latest changes from dev branch
2 parents 86980e3 + 1752787 commit d7e919e

File tree

107 files changed

+1898
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1898
-432
lines changed

Doc.meta

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

Doc/Motivation.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Why Debug Chan?
2+
3+
For complex projects “just logging to the console” is helpful but also a time waster; logging to the console either means a "free for all" approach (much junk to the console) or a zero trace policy (very little information to frame incoming issues).
4+
5+
Debug Chan is meant to support a principled approach, where developers write (relatively) humanly readable and much less transient traces to document program execution.
6+
7+
As such, debug chan implements three essential features:
8+
9+
**Channeled logging** - select a game object or component to view matching traces.
10+
11+
**Frame logging** - frame based processes often exhibit "stable" frame ranges. When an object look 'stuck', more likely than not they are cycling through the same trace over and over.
12+
13+
**Channeled histories** - view an object's recent (or not so recent) history, aggregated via frame ranges.

Doc/Motivation.md.meta

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

Editor/Active.Prolog.asmdef

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "Activ.Prolog",
3-
"references": [],
4-
"optionalUnityReferences": [],
3+
"references": [
4+
"GUID:915b17af40d5d214abbf6b22495814a5"
5+
],
56
"includePlatforms": [
67
"Editor"
78
],
@@ -12,9 +13,11 @@
1213
"Mono.Cecil.dll",
1314
"Mono.Cecil.Mdb.dll",
1415
"Mono.Cecil.Pdb.dll",
15-
"Mono.Cecil.Rocks.dll"
16+
"Mono.Cecil.Rocks.dll",
17+
""
1618
],
1719
"autoReferenced": true,
1820
"defineConstraints": [],
19-
"versionDefines": []
20-
}
21+
"versionDefines": [],
22+
"noEngineReferences": false
23+
}

Editor/ConfigKeys.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

Editor/Core.meta

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

Editor/Config.cs renamed to Editor/Core/Config.cs

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,75 @@
22
using System.Linq; using System.IO; using System.Text;
33
using S = System.String;
44
using UnityEditor; using static UnityEditor.EditorPrefs;
5-
using static Activ.Prolog.ConfigKeys;
5+
using static Activ.Loggr.ConfigKeys;
66

7-
namespace Activ.Prolog{
7+
namespace Activ.Loggr{
88
public class Config : AssetPostprocessor{
99

1010
public const int LogLineLength = 32;
1111
public const int MaxLines = 1000;
1212

13-
static List<string> elements = File.Exists(ConfigKeys.Path) ?
14-
(from s in File.ReadAllText(ConfigKeys.Path).Split('\n')
15-
select s.Trim()).ToList() : null;
13+
// -------------------------------------------------------------
1614

17-
public static bool logToFile => elements?.Contains(FileFlag) ?? false;
15+
public static bool allFrames
16+
{ set => SetBool(AllFrames, value); get => GetBool(AllFrames, true); }
1817

19-
public static bool enable{
18+
public static bool enableInjection{
2019
set{
21-
if(value == enable) return;
20+
if(value == enableInjection) return;
2221
SetBool(EnableLogging, value);
23-
Recompile.Apply();
24-
} get => GetBool(EnableLogging);
22+
// TODO dep? enableInjection should be prolog config
23+
// not here
24+
Activ.Prolog.Recompile.Apply();
25+
}get{
26+
try{
27+
return GetBool(EnableLogging);
28+
}catch(System.Exception){
29+
//UnityEngine.Debug.Log(ex)
30+
return false;
31+
}
32+
}
2533
}
2634

27-
public static bool allFrames
28-
{ set => SetBool(AllFrames, value); get => GetBool(AllFrames); }
35+
public static float handleSize
36+
{ set => SetFloat(HandleSize, value); get => GetFloat(HandleSize); }
2937

30-
public static bool useSelection
31-
{ set => SetBool(UseSelection, value); get => GetBool(UseSelection); }
38+
public static float historySpan
39+
{ set => SetFloat(HistorySpan, value); get => GetFloat(HistorySpan, 10f); }
3240

33-
public static float trailOffset
34-
{ set => SetFloat(TrailOffset, value); get => GetFloat(TrailOffset); }
41+
public static bool logToConsole
42+
{ set => SetBool(LogToConsole, value); get => GetBool(LogToConsole, false); }
3543

36-
public static float handleSize
37-
{ set => SetFloat(HandleSize, value); get => GetFloat(HandleSize); }
44+
public static bool logToFile => elements?.Contains(FileFlag) ?? false;
45+
46+
public static int maxMessages
47+
{ set => SetInt(MaxMessages, value); get => GetInt(MaxMessages, 25000); }
3848

3949
public static int rtypeIndex
4050
{ set => SetInt(RTypeIndex, value); get => GetInt(RTypeIndex); }
4151

4252
public static bool step
4353
{ set => SetBool(Step, value); get => GetBool(Step); }
4454

55+
public static float trailOffset
56+
{ set => SetFloat(TrailOffset, value); get => GetFloat(TrailOffset); }
57+
58+
public static bool useSelection
59+
{ set => SetBool(UseSelection, value); get => GetBool(UseSelection, true); }
60+
61+
// -------------------------------------------------------------
62+
4563
public static bool Exclude(string arg) => elements?.Contains(arg) ?? false;
4664

65+
// Static properties -------------------------------------------
66+
67+
static List<string> elements = File.Exists(ConfigKeys.Path) ?
68+
(from s in File.ReadAllText(ConfigKeys.Path).Split('\n')
69+
select s.Trim()).ToList() : null;
70+
4771
static void OnPostprocessAllAssets (S[] i, S[] d, S[] m, S[] mf){
4872
if(!i.Contains(ConfigKeys.Path)) return;
49-
print("Config changed - recompile"); Recompile.Apply();
73+
print("Config changed - recompile"); Activ.Prolog.Recompile.Apply();
5074
}
5175

5276
static void print(string x) => UnityEngine.Debug.Log(x);
File renamed without changes.

Editor/Core/ConfigKeys.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Activ.Loggr{
2+
public static class ConfigKeys{
3+
4+
public const string UseSelection = "Activ.Loggr.UseSel",
5+
AllFrames = "Activ.Loggr.AllFrames",
6+
Step = "Activ.Loggr.Step",
7+
RTypeIndex = "Prolog.RType",
8+
MaxMessages = "Activ.Loggr.MaxMessages",
9+
EnableLogging = "Prolog.enable",
10+
LogToConsole = "Activ.Loggr.LogToConsole",
11+
FileFlag = "--file",
12+
LogPath = "Assets/log.txt",
13+
Name = "prolog.config",
14+
Path = "Assets/prolog.config",
15+
TrailOffset = "Activ.Loggr.TrailOffset",
16+
HandleSize = "Activ.Loggr.HandleSize",
17+
HistorySpan = "Activ.Loggr.HistorySpan";
18+
19+
}}
File renamed without changes.

0 commit comments

Comments
 (0)