add option for maximum hexdump length

This commit is contained in:
wish
2022-07-26 20:06:01 +10:00
parent 03714235f7
commit 92041ba0f4
3 changed files with 233 additions and 227 deletions

View File

@@ -8,6 +8,7 @@
"maxlauncherhr": true,
"LogInboundMessages": false,
"LogOutboundMessages": false,
"MaxHexdumpLength": 256,
"Event": 0,
"DivaEvent": 0,
"FestaEvent": 0,

View File

@@ -29,6 +29,7 @@ type DevModeOptions struct {
FixedStageID bool // Causes all move_stage to use the ID sl1Ns200p0a0u0 to get you into all stages
LogInboundMessages bool // Log all messages sent to the server
LogOutboundMessages bool // Log all messages sent to the clients
MaxHexdumpLength int // Maximum number of bytes printed when logs are enabled
DivaEvent int // Diva Defense event status
FestaEvent int // Hunter's Festa event status
TournamentEvent int // VS Tournament event status

View File

@@ -239,5 +239,9 @@ func (s *Session) logMessage(opcode uint16, data []byte, sender string, recipien
}
fmt.Printf("[%s] -> [%s]\n", sender, recipient)
fmt.Printf("Opcode: %s\n", opcodePID)
if len(data) <= s.server.erupeConfig.DevModeOptions.MaxHexdumpLength {
fmt.Printf("Data [%d bytes]:\n%s\n", len(data), hex.Dump(data))
} else {
fmt.Printf("Data [%d bytes]:\n(Too long!)\n\n", len(data))
}
}