Add Serilog console logging across the API
Information at endpoint and service-method boundaries, Debug in deeper helpers, Warning before expected/recoverable failures (not-found, validation, agent tool errors), Error on caught exceptions. Serilog wraps the exception handler so request-completion logs report the resolved status code rather than the raw exception. Never logs prose bodies or the Anthropic API key.
This commit is contained in:
@@ -17,8 +17,7 @@ public class NovelApiClient(HttpClient http)
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
public Task<CallToolResult> GetAsync(string path, CancellationToken ct = default) =>
|
||||
SendAsync(new HttpRequestMessage(HttpMethod.Get, path), ct);
|
||||
public Task<CallToolResult> GetAsync(string path, CancellationToken ct = default) => SendAsync(new HttpRequestMessage(HttpMethod.Get, path), ct);
|
||||
|
||||
public Task<CallToolResult> PostAsync(string path, object body, CancellationToken ct = default) =>
|
||||
SendAsync(new HttpRequestMessage(HttpMethod.Post, path)
|
||||
@@ -32,8 +31,7 @@ public class NovelApiClient(HttpClient http)
|
||||
Content = JsonContent.Create(body, options: Options)
|
||||
}, ct);
|
||||
|
||||
public Task<CallToolResult> DeleteAsync(string path, CancellationToken ct = default) =>
|
||||
SendAsync(new HttpRequestMessage(HttpMethod.Delete, path), ct);
|
||||
public Task<CallToolResult> DeleteAsync(string path, CancellationToken ct = default) => SendAsync(new HttpRequestMessage(HttpMethod.Delete, path), ct);
|
||||
|
||||
/// <summary>
|
||||
/// Sends the request and shapes the outcome as a tool result. Failures come back as
|
||||
|
||||
Reference in New Issue
Block a user