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:
@@ -1,3 +1,4 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Novelly.Api.Agent;
|
||||
using Novelly.Api.Common;
|
||||
@@ -13,7 +14,7 @@ public class AnthropicClientTests
|
||||
// (listing conversations, reading a transcript). Throwing at construction would
|
||||
// take those down on any install that has not configured a key yet.
|
||||
Assert.That(
|
||||
() => new AnthropicAgentModelClient(Options.Create(new AgentOptions())),
|
||||
() => new AnthropicAgentModelClient(Options.Create(new AgentOptions()), NullLogger<AnthropicAgentModelClient>.Instance),
|
||||
Throws.Nothing);
|
||||
|
||||
[Test]
|
||||
@@ -24,7 +25,7 @@ public class AnthropicClientTests
|
||||
|
||||
try
|
||||
{
|
||||
var client = new AnthropicAgentModelClient(Options.Create(new AgentOptions()));
|
||||
var client = new AnthropicAgentModelClient(Options.Create(new AgentOptions()), NullLogger<AnthropicAgentModelClient>.Instance);
|
||||
|
||||
Assert.That(
|
||||
async () => await client.CompleteAsync("system", [], []),
|
||||
|
||||
Reference in New Issue
Block a user