Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1c065b4

Browse files
committedFeb 12, 2025·
Open engine to customize logging.
1 parent 3694da3 commit 1c065b4

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed
 

‎Library/Scripting/Engine/IScriptSite.cs

+5
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ public interface IScriptSite
107107
/// Report the outer script.
108108
/// </summary>
109109
IScript? MainScript { get; }
110+
111+
/// <summary>
112+
/// Update the current log entry.
113+
/// </summary>
114+
Task UpdateLogAsync();
110115
}
111116

112117
/// <summary>

‎Library/Scripting/Engine/ScriptEngine.Nested.cs

+3
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ private async Task RunScriptAsync(IScriptInstance<TLogType> script)
224224

225225
/// <inheritdoc/>
226226
public virtual Task DoneExecuteGroupAsync(GroupStatus status) => Task.CompletedTask;
227+
228+
/// <inheritdoc/>
229+
public Task UpdateLogAsync() => CurrentScript == null ? Task.CompletedTask : _engine.UpdateResultLogEntryAsync(CurrentScript, Parent, false);
227230
}
228231

229232
/// <summary>

‎Library/Scripting/Engine/ScriptEngine.cs

+12
Original file line numberDiff line numberDiff line change
@@ -546,4 +546,16 @@ public async Task<GroupStatus> EndGroupAsync(GroupResult result)
546546

547547
/// <inheritdoc/>
548548
public virtual Task DoneExecuteGroupAsync(GroupStatus status) => Task.CompletedTask;
549+
550+
/// <inheritdoc/>
551+
public Task UpdateLogAsync() => CurrentScript == null ? Task.CompletedTask : UpdateResultLogEntryAsync(CurrentScript, null, false);
552+
553+
/// <summary>
554+
///
555+
/// </summary>
556+
/// <param name="script"></param>
557+
/// <param name="parent"></param>
558+
/// <param name="final"></param>
559+
/// <returns></returns>
560+
protected virtual Task UpdateResultLogEntryAsync(IScript<TLogType> script, IScript<TLogType>? parent, bool final) => Task.CompletedTask;
549561
}

0 commit comments

Comments
 (0)
Please sign in to comment.