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:
@@ -29,18 +29,37 @@ public abstract class ServiceTestFixture
|
||||
protected CharacterArcService Arcs { get; private set; } = null!;
|
||||
protected OpenQuestionService Questions { get; private set; } = null!;
|
||||
|
||||
protected CapturingLogger<ProjectService> ProjectLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<CharacterService> CharacterLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<ChapterService> ChapterLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<SceneService> SceneLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<BeatService> BeatLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<TagService> TagLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<CharacterArcService> ArcLogs { get; private set; } = null!;
|
||||
protected CapturingLogger<OpenQuestionService> QuestionLogs { get; private set; } = null!;
|
||||
|
||||
[SetUp]
|
||||
public void SetUpFixture()
|
||||
{
|
||||
Db = new TestDatabase();
|
||||
Tags = new TagService(Db.Context);
|
||||
Projects = new ProjectService(Db.Context);
|
||||
Characters = new CharacterService(Db.Context, Tags);
|
||||
Chapters = new ChapterService(Db.Context, Tags);
|
||||
Scenes = new SceneService(Db.Context);
|
||||
Beats = new BeatService(Db.Context, Tags);
|
||||
Arcs = new CharacterArcService(Db.Context);
|
||||
Questions = new OpenQuestionService(Db.Context);
|
||||
|
||||
TagLogs = new CapturingLogger<TagService>();
|
||||
ProjectLogs = new CapturingLogger<ProjectService>();
|
||||
CharacterLogs = new CapturingLogger<CharacterService>();
|
||||
ChapterLogs = new CapturingLogger<ChapterService>();
|
||||
SceneLogs = new CapturingLogger<SceneService>();
|
||||
BeatLogs = new CapturingLogger<BeatService>();
|
||||
ArcLogs = new CapturingLogger<CharacterArcService>();
|
||||
QuestionLogs = new CapturingLogger<OpenQuestionService>();
|
||||
|
||||
Tags = new TagService(Db.Context, TagLogs);
|
||||
Projects = new ProjectService(Db.Context, ProjectLogs);
|
||||
Characters = new CharacterService(Db.Context, Tags, CharacterLogs);
|
||||
Chapters = new ChapterService(Db.Context, Tags, ChapterLogs);
|
||||
Scenes = new SceneService(Db.Context, SceneLogs);
|
||||
Beats = new BeatService(Db.Context, Tags, BeatLogs);
|
||||
Arcs = new CharacterArcService(Db.Context, ArcLogs);
|
||||
Questions = new OpenQuestionService(Db.Context, QuestionLogs);
|
||||
|
||||
OnSetUp();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user