Skip to content

Conversation

@Big-Iron-Cheems
Copy link
Collaborator

Type of change

  • Bug fix
  • New feature

Description

Add PacketLogger module.

Related issues

Closes #5686.

How Has This Been Tested?

Singleplayer testing.

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

@Big-Iron-Cheems
Copy link
Collaborator Author

The module works as intended, but there's alwasy room for improvement.
If anyone has suggestions to expand this implementation feel free to let me know, send .patch files if possible.

@Big-Iron-Cheems Big-Iron-Cheems marked this pull request as ready for review December 27, 2025 14:15
.build()
);

private final Object2IntOpenHashMap<Class<? extends Packet<?>>> packetCounts = new Object2IntOpenHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably Reference2IntOpenHashMap because keys are Class instances

Files.createDirectories(logPath);

String fileName = "packets-%s.log".formatted(LocalDateTime.now().format(fileNameFormatter));
fileWriter = Files.newBufferedWriter(logPath.resolve(fileName), StandardOpenOption.CREATE, StandardOpenOption.WRITE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cause long-period file occupy on Windows?

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.

[Suggestion] packet logger

2 participants