diff --git a/.github/workflows/ci-build-windows.yml b/.github/workflows/ci-build-windows.yml index 31e8b9e44..a00f75925 100644 --- a/.github/workflows/ci-build-windows.yml +++ b/.github/workflows/ci-build-windows.yml @@ -34,6 +34,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Setup .NET uses: actions/setup-dotnet@v5 @@ -73,6 +74,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Setup .NET uses: actions/setup-dotnet@v5 @@ -116,6 +118,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Setup .NET uses: actions/setup-dotnet@v5 diff --git a/.github/workflows/ci-linux-dev.yml b/.github/workflows/ci-linux-dev.yml index 649e3166d..057ed08a5 100644 --- a/.github/workflows/ci-linux-dev.yml +++ b/.github/workflows/ci-linux-dev.yml @@ -27,6 +27,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 @@ -60,6 +61,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 @@ -89,6 +91,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 diff --git a/.github/workflows/ci-linux-main.yml b/.github/workflows/ci-linux-main.yml index 8ee8a23e6..8eae0a8ee 100644 --- a/.github/workflows/ci-linux-main.yml +++ b/.github/workflows/ci-linux-main.yml @@ -47,6 +47,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 @@ -81,6 +82,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 @@ -100,29 +102,6 @@ jobs: bash ./tools/ci/clang_tidy.sh build " - cargo-log-server: - name: Cargo log_server (${{ matrix.build_type }}) - runs-on: [self-hosted, Linux, X64] - strategy: - matrix: - build_type: [debug, release] - fail-fast: false - steps: - - name: Checkout PR branch - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - fetch-depth: 1 - - - name: Install Nix - uses: cachix/install-nix-action@v31.10.6 - - - name: Cargo build - env: - RELEASE_FLAG: ${{ matrix.build_type == 'release' && '--release' || '' }} - run: nix develop --command bash -c "rustup toolchain install stable --no-self-update && rustup default stable && cargo build --manifest-path tools/log_server/Cargo.toml $RELEASE_FLAG" - cargo-reflection-generator: name: Cargo reflection_generator (${{ matrix.build_type }}) runs-on: [self-hosted, Linux, X64] @@ -137,6 +116,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 @@ -146,29 +126,6 @@ jobs: RELEASE_FLAG: ${{ matrix.build_type == 'release' && '--release' || '' }} run: nix develop --command bash -c "rustup toolchain install stable --no-self-update && rustup default stable && cargo build --manifest-path tools/reflection_generator/Cargo.toml $RELEASE_FLAG" - cargo-kenzo: - name: Cargo kenzo (${{ matrix.build_type }}) - runs-on: [self-hosted, Linux, X64] - strategy: - matrix: - build_type: [debug, release] - fail-fast: false - steps: - - name: Checkout PR branch - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.head_ref }} - fetch-depth: 1 - - - name: Install Nix - uses: cachix/install-nix-action@v31.10.6 - - - name: Cargo build - env: - RELEASE_FLAG: ${{ matrix.build_type == 'release' && '--release' || '' }} - run: nix develop --command bash -c "rustup toolchain install stable --no-self-update && rustup default stable && cargo build --manifest-path tools/kenzo/Cargo.toml $RELEASE_FLAG" - dotnet-editor: name: Dotnet editor (${{ matrix.build_type }}) runs-on: [self-hosted, Linux, X64] @@ -183,6 +140,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 @@ -204,6 +162,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} fetch-depth: 1 + submodules: true - name: Install Nix uses: cachix/install-nix-action@v31.10.6 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..79cea7045 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tools/kenzo"] + path = tools/kenzo + url = https://github.com/ynks/kenzo diff --git a/docs/logging_system.md b/docs/logging_system.md index 7b3d5e6f0..b5ca0b5ba 100644 --- a/docs/logging_system.md +++ b/docs/logging_system.md @@ -6,8 +6,8 @@ > The logging system provides an easy way to write logs and visualize them after the program -execution has finished. It contains a C++ implementation for producing messages, a Rust -server for receiving, processing and storing messages, and a Rust TUI for easily reading +execution has finished. It contains a C++ implementation for producing messages, a C++ +server for receiving, processing and storing messages, and a TUI for easily reading and searching for information after reading. To use this system you can simply just include `` and call any of the toast diff --git a/editor/Engine/Log.cs b/editor/Engine/Log.cs index 4e681df31..95ef66bda 100644 --- a/editor/Engine/Log.cs +++ b/editor/Engine/Log.cs @@ -31,6 +31,14 @@ public static void Critical( Dispatch(toast_critical, message, Path.GetFileName(fileName), (uint)lineNumber); } + public static void InvalidateBacktraceCache() { + try { + toast_log_invalidate_backtraces(); + } catch (DllNotFoundException) { + // Nothing was resolved without the engine + } + } + // Fallback to the console if toast-engine is not loaded private static void Dispatch( Action sink, string message, string fileName, uint lineNumber) { @@ -56,4 +64,7 @@ private static void Dispatch( [LibraryImport("toast_engine", StringMarshalling = StringMarshalling.Utf8)] private static partial void toast_critical(string sink, string message, string fileName, uint lineNumber); + + [LibraryImport("toast_engine")] + private static partial void toast_log_invalidate_backtraces(); } diff --git a/editor/Engine/ToastEngine.cs b/editor/Engine/ToastEngine.cs index 0321729cc..f9c8b871f 100644 --- a/editor/Engine/ToastEngine.cs +++ b/editor/Engine/ToastEngine.cs @@ -326,6 +326,7 @@ public void ReloadGame() { Log.Info($"Reloading game library: {gameDll}"); File.Copy(gameDll, newTempPath); newHandle = NativeLibrary.Load(newTempPath); + Log.InvalidateBacktraceCache(); var newCreate = Marshal.GetDelegateForFunctionPointer(NativeLibrary.GetExport(newHandle, "game_create")); var newDestroy = @@ -347,7 +348,10 @@ public void ReloadGame() { toast_begin_application(); } catch (Exception ex) { if (!adopted) { - if (newHandle != IntPtr.Zero) NativeLibrary.Free(newHandle); + if (newHandle != IntPtr.Zero) { + NativeLibrary.Free(newHandle); + Log.InvalidateBacktraceCache(); + } TryDeleteGameTemp(newTempPath); } @@ -451,6 +455,7 @@ private string FindGameDll() { private void LoadFrom(string dllPath) { m_gameHandle = NativeLibrary.Load(dllPath); + Log.InvalidateBacktraceCache(); m_gameTempPath = dllPath; m_gameCreate = Marshal.GetDelegateForFunctionPointer(NativeLibrary.GetExport(m_gameHandle, "game_create")); @@ -472,6 +477,7 @@ private void ReleaseGameLibraries() { } m_retiredGameLibraries.Clear(); + Log.InvalidateBacktraceCache(); } private static void TryDeleteGameTemp(string path) { diff --git a/editor/Logger/LogCsv.cs b/editor/Logger/LogCsv.cs index a34e967fd..0fd8c5473 100644 --- a/editor/Logger/LogCsv.cs +++ b/editor/Logger/LogCsv.cs @@ -12,6 +12,8 @@ namespace editor.Logger; // Mirrors the CSV format written by the log_server internal static class LogCsv { + public const string Header = "Timestamp,Severity,Filepath,Line,Sink,Message,Details,Backtrace"; + private static readonly string[] s_severityNames = ["TRACE", "INFO", "WARNING", "ERROR", "CRITICAL"]; private static readonly SearchValues s_mustQuote = SearchValues.Create(",\"\r\n"); @@ -33,6 +35,10 @@ public static string ToCsvLine(LogEntry entry) { AppendField(sb, entry.Sink); sb.Append(','); AppendField(sb, entry.Message); + sb.Append(','); + AppendField(sb, entry.Details); + sb.Append(','); + AppendField(sb, entry.Backtrace); return sb.ToString(); } diff --git a/editor/Logger/LogDetailWindow.axaml b/editor/Logger/LogDetailWindow.axaml index c893fb921..2abf4a6ba 100644 --- a/editor/Logger/LogDetailWindow.axaml +++ b/editor/Logger/LogDetailWindow.axaml @@ -10,7 +10,7 @@ x:DataType="vm:LogEntry" Width="700" MinHeight="260" - MaxHeight="640" + MaxHeight="900" SizeToContent="Height" CanResize="False" CanMaximize="False" @@ -39,7 +39,8 @@ + CornerRadius="3" + VerticalAlignment="Center"/> @@ -81,17 +86,56 @@ CornerRadius="8" Padding="8" MaxHeight="300"> + + + + + + + + + + - - - + - -