2025-02-27 20:17:51 +01:00
|
|
|
using AIStudio.Tools.Rust;
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Tools.Services;
|
|
|
|
|
|
|
|
|
|
public sealed partial class RustService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the paths of the log files.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>The paths of the log files.</returns>
|
|
|
|
|
public async Task<GetLogPathsResponse> GetLogPaths()
|
|
|
|
|
{
|
2026-11-03 07:59:30 +01:00
|
|
|
return await this.http.GetFromJsonAsync<GetLogPathsResponse>("/log/paths", JSON_OPTIONS);
|
2025-02-27 20:17:51 +01:00
|
|
|
}
|
2026-01-13 18:45:47 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
2026-11-26 12:01:08 +01:00
|
|
|
/// Queues a log event for the Rust runtime.
|
2026-01-13 18:45:47 +01:00
|
|
|
/// </summary>
|
2026-10-10 19:05:41 +02:00
|
|
|
/// <param name="timestamp">When the log event happened, formatted by TerminalLogger.FormatTransportTimestamp.</param>
|
2026-01-13 18:45:47 +01:00
|
|
|
/// <param name="level">The log level.</param>
|
|
|
|
|
/// <param name="category">The category of the log event.</param>
|
|
|
|
|
/// <param name="message">The log message.</param>
|
|
|
|
|
/// <param name="exception">Optional exception message.</param>
|
|
|
|
|
/// <param name="stackTrace">Optional exception stack trace.</param>
|
2026-11-26 12:01:08 +01:00
|
|
|
/// <remarks>
|
|
|
|
|
/// Never waits: the event joins the queue of RustLogForwarder, which sends it in a batch.
|
|
|
|
|
/// </remarks>
|
2026-01-13 18:45:47 +01:00
|
|
|
public void LogEvent(string timestamp, string level, string category, string message, string? exception = null, string? stackTrace = null)
|
|
|
|
|
{
|
2026-11-26 12:01:08 +01:00
|
|
|
this.logForwarder.Enqueue(new LogEventRequest(timestamp, level, category, message, exception, stackTrace));
|
2026-01-13 18:45:47 +01:00
|
|
|
}
|
2025-02-27 20:17:51 +01:00
|
|
|
}
|