public class PacketLogger extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PacketLogger.LoggerOptions
Packet logger options
|
static class |
PacketLogger.LogMessage
Log message
|
| Constructor and Description |
|---|
PacketLogger(PacketLogger.LoggerOptions opts)
Constructs the class
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFilePath(String accountId)
Returns path for account log file
|
void |
logPacket(com.fasterxml.jackson.databind.JsonNode packet)
Processes packets and pushes them into save queue
|
List<PacketLogger.LogMessage> |
readLogs(String accountId)
Returns log messages
|
List<PacketLogger.LogMessage> |
readLogs(String accountId,
Date dateAfter,
Date dateBefore)
Returns log messages within date bounds as an array of objects
|
void |
start()
Initializes the packet logger
|
void |
stop()
Deinitializes the packet logger
|
public PacketLogger(PacketLogger.LoggerOptions opts) throws IOException, ValidationException
opts - packet logger optionsIOException - if log directory cannot be createdValidationException - if specified opts are invalidpublic void logPacket(com.fasterxml.jackson.databind.JsonNode packet)
packet - packet to logpublic List<PacketLogger.LogMessage> readLogs(String accountId)
accountId - account idpublic List<PacketLogger.LogMessage> readLogs(String accountId, Date dateAfter, Date dateBefore)
accountId - account iddateAfter - date to get logs after, or nulldateBefore - date to get logs before, or nullpublic String getFilePath(String accountId) throws IOException
accountId - account idIOException - if failed to create file directorypublic void start()
public void stop()
Copyright © 2021. All rights reserved.