Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for loading files, decoding them as JSONL, and formatting them using a Logback-like format string. #46

Merged
merged 90 commits into from
Jul 3, 2024

Conversation

junhaoliao
Copy link
Collaborator

@junhaoliao junhaoliao commented Jun 14, 2024

References

#45

Description

  1. Implement LogFileManager class for efficient log file handling.
  2. Add decoder interface.
  3. Add Decode Options to File Loading Process.
  4. Add support for JSONL log file decoding.

Validation performed

  1. Placed example.jsonl file under /public/test. (Can be downloaded and extracted from example.jsonl.zip)
  2. Launched debug server with npm run start.
  3. Observed last page of decoded results displayed in the browser. e.g.:
    image

@junhaoliao
Copy link
Collaborator Author

@Henry8192 Please help triage the review.

@junhaoliao junhaoliao changed the title WIP - Add log file management and jsonl decoder functionality. Add log file management and jsonl decoder functionality. Jun 14, 2024
Copy link
Collaborator

@Henry8192 Henry8192 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some JSDocs.

new-log-viewer/src/components/Layout.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/services/decoders/JsonlDecoder.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/decoders/JsonlDecoder.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/decoders/JsonlDecoder.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/decoders/JsonlDecoder.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/decoders/JsonlDecoder.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/components/Layout.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/contexts/StateContextProvider.tsx Outdated Show resolved Hide resolved
new-log-viewer/src/services/MainWorker.ts Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved
new-log-viewer/src/services/LogFileManager.ts Outdated Show resolved Hide resolved

messages.push(m);
lines.set(currentLine, logEventNum);
currentLine += m.split("\n").length - 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to think about for the future---perhaps we should return the number of lines per log event from the decoder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. how do we plan to use that? With that approach, we would have to use an accumulator to deduct the log event Num (index) from the editor cursor line, right? (Do you mean we send the lines per log event to the renderer, and let the renderer calculate once and cache the beginLineNumToLogEventNum[]?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just mean we could use it here instead of calling msg.split('\n').length - 1 every time we load a page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants