Skip to content

Commit b9612bc

Browse files
authored
feat: update version to 0.1.0-alpha.5; improve logging structure; update documentation links (#6)
1 parent 74fa6ae commit b9612bc

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

Runtime/Core/Context/Context.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ internal static IEnumerator InitCoroutine(ConsoleStorage storage, string session
8282
}
8383
else
8484
{
85+
//TODO: send user id to server
8586
var initContextRequest = new InitContextRequest(sessionId, storage.ProjectSettings.APIKey, JahroConfig.CurrentVersion);
8687
context._selectedUserInfo = ConsoleStorageController.Instance.ConsoleStorage.SelectedUserInfo;
8788
initContextRequest.OnComplete = (result) =>
@@ -93,6 +94,11 @@ internal static IEnumerator InitCoroutine(ConsoleStorage storage, string session
9394
{
9495
context._selectedUserInfo = context._teamMembers[0];
9596
}
97+
else
98+
{
99+
var selectedUser = context._teamMembers.FirstOrDefault(m => m.Id == context._selectedUserInfo.Id);
100+
context._selectedUserInfo = selectedUser;
101+
}
96102
onProcessed(context);
97103
};
98104
initContextRequest.OnFail = (error, responseCode) =>

Runtime/Core/Context/JahroConfig.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ public enum Environment
1010

1111
internal const Environment ENV = Environment.PROD;
1212

13-
internal static readonly string CurrentVersion = "0.1.0-alpha.4";
13+
internal static readonly string CurrentVersion = "0.1.0-alpha.5";
1414

1515
internal static readonly string RegisterUrl = "https://console.jahro.io";
1616

1717
internal static readonly string DocumentationRoot = "https://docs.jahro.io/";
1818

19-
internal static readonly string DocumentationWatcherOverview = "https://docs.jahro.io/watcher";
19+
internal static readonly string DocumentationWatcherOverview = "https://docs.jahro.io/start-here/watcher";
2020

21-
internal static readonly string DocumentationCommandsOverview = "https://docs.jahro.io/commands";
21+
internal static readonly string DocumentationCommandsOverview = "https://docs.jahro.io/start-here/commands";
2222

2323
internal static readonly string HostUrl = ENV == Environment.PROD ? "https://octopus-app-p98wl.ondigitalocean.app/jahro-api" : "http://localhost:3000";
2424
}

Runtime/Core/Context/JahroSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JahroConsole.Core.Data;
44
using JahroConsole.Core.Registry;
55
using JahroConsole.Core.Snapshots;
6+
using UnityEngine;
67

78
namespace JahroConsole.Core.Context
89
{
@@ -46,7 +47,6 @@ internal static IEnumerator StartNewSession(Action<JahroContext> OnContextLoaded
4647
SnapshotsManager.Instance.StartRecording();
4748
Current = new JahroSession();
4849
ConsoleStorageController.LoadState();
49-
5050
yield return JahroContext.InitCoroutine(ConsoleStorageController.Instance.ConsoleStorage, Current._sessionID, (context) =>
5151
{
5252
Current._context = context;

Runtime/Core/Snapshots/SnapshotLogWriter.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ namespace JahroConsole.Core.Snapshots
1111
{
1212
internal class SnapshotLogWriter
1313
{
14+
private const string LOG_START = "@JAHRO_LOG_START@";
15+
private const string MSG_START = "@JAHRO_MSG_START@";
16+
private const string TRACE_START = "@JAHRO_TRACE_START@";
17+
private const string LOG_END = "@JAHRO_LOG_END@";
18+
private const string LINE_END = "\n";
1419
private readonly ConcurrentQueue<string> _logQueue = new ConcurrentQueue<string>();
1520
private readonly SemaphoreSlim _logSignal = new SemaphoreSlim(0);
1621
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
@@ -84,7 +89,24 @@ internal async Task ForceFlushBuffer()
8489
internal void Log(string message, string logType, string stackTrace)
8590
{
8691
var timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff");
87-
var logEntry = $"{{\"timestamp\": \"{timestamp}\", \"type\": \"{logType}\", \"message\": \"{message}\", \"stacktrace\": \"{stackTrace}\"}}\n=%J%=\n";
92+
var messageLength = message?.Length ?? 0;
93+
var stackTraceLength = stackTrace?.Length ?? 0;
94+
95+
var header = $"{{\n" +
96+
$" \"timestamp\": \"{timestamp}\",\n" +
97+
$" \"type\": \"{logType}\",\n" +
98+
$" \"message_length\": {messageLength},\n" +
99+
$" \"stacktrace_length\": {stackTraceLength}\n" +
100+
$"}}";
101+
102+
var logEntry = $"{LOG_START}{LINE_END}" +
103+
$"{header}{LINE_END}" +
104+
$"{MSG_START}{LINE_END}" +
105+
$"{message ?? ""}{LINE_END}" +
106+
$"{TRACE_START}{LINE_END}" +
107+
$"{stackTrace ?? ""}{LINE_END}" +
108+
$"{LOG_END}{LINE_END}";
109+
88110
_logQueue.Enqueue(logEntry);
89111
_logSignal.Release();
90112
}

Runtime/Core/Snapshots/SnapshotUploadRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal override List<IMultipartFormSection> FormDataMultipart()
7878
internal override void FillHeaders(UnityWebRequest request)
7979
{
8080
request.SetRequestHeader("x-api-key", _key);
81-
request.SetRequestHeader("x-log-version", "1.1");
81+
request.SetRequestHeader("x-log-version", "1.2");
8282
}
8383

8484
protected override void OnRequestComplete(string result)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "io.jahro.console",
3-
"version": "0.1.0-alpha.3",
3+
"version": "0.1.0-alpha.5",
44
"displayName": "Jahro",
55
"description": "Jahro is a powerful and easy-to-use Unity debugging console and runtime tool. Effortlessly execute commands, monitor variables in real-time, capture logs, and sync snapshots to analyze your game like never before. Perfect for developers who want a smarter way to debug, test, and optimize their Unity projects!",
66
"unity": "2019.1",

0 commit comments

Comments
 (0)