Homework 01-basic: 实现日志解析与 Dump - #92
Open
invincible-summer wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes the 01-basic homework tasks by implementing parsing and dump output for request and internal log events, and adds the corresponding written report.
Changes:
- Implemented
request/internalevent parsing inLineParserand added message DTOs for deserialization. - Implemented visitor support for dumping
RequestLogEntryandInternalLogEntryas key-value pairs and wired up visitorAcceptmethods. - Added
docs/01-basic/report.mdand ignored.obsidian/workspace files.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/LogParser/Visitors/KeyValueVisitor.cs | Adds key-value dump output for Request/Internal log entries. |
| src/LogParser/Parser/LineParser.cs | Implements parsing for Request/Internal events and their message shapes. |
| src/LogParser/Models/LogEntries.cs | Implements Accept for Request/Internal entries to enable visitor dispatch. |
| docs/01-basic/report.md | Adds homework report content for 01-basic. |
| .gitignore | Ignores .obsidian/ directory. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+71
to
+83
| var exceptionspilt = internalMessage.Exception.IndexOf(": "); | ||
| if (exceptionspilt == -1) | ||
| { | ||
| throw new FormatException($"Invalid exception format: {internalMessage.Exception}"); | ||
| } | ||
| return new InternalLogEntry( | ||
| LineNo: logRecord.LineNo, | ||
| Timestamp: DateTimeOffset.Parse(logRecord.Timestamp), | ||
| PodName: logRecord.PodName, | ||
| Severity: ParseSeverity(internalMessage.Severity), | ||
| ExceptionName: internalMessage.Exception.Substring(0, exceptionspilt), | ||
| ExceptionMessage: internalMessage.Exception.Substring(exceptionspilt + 2) | ||
| ); |
| + 在对日志中 JSON 格式的 `message` 字段进行读取时,我们是在哪个方法内用哪几条语句判断这一行日志的种类(Call / Request / Internal)的? | ||
|
|
||
| ```c | ||
| // 通过 LineRarse 的 ParseLine 方法 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
暑培:队式作业提交
基本信息
提交说明
01-basic作业提交通道 #32