fix: Adds packet logging (#836)
### Enabling Packet Logging `[packetlogging on` and target the user. Supports command modifiers such as: `[online packetlogging on where accesslevel = player` Logs are saved in `path/<ip address>/packets.log`. It is a simple append-format log with no date splitting.
This commit is contained in:
parent
85d699fcd7
commit
2890f5c3ec
6 changed files with 186 additions and 193 deletions
|
|
@ -59,6 +59,27 @@ namespace Server.Text
|
|||
return result;
|
||||
}
|
||||
|
||||
public static unsafe int ToSpacedHexString(this ReadOnlySpan<byte> bytes, Span<char> result)
|
||||
{
|
||||
var charsWritten = 0;
|
||||
fixed (char* resultP = result)
|
||||
{
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
var resultP2 = (uint*)(resultP + charsWritten);
|
||||
*resultP2 = m_Lookup32Chars[bytes[i]];
|
||||
charsWritten += 2;
|
||||
|
||||
if (i < bytes.Length - 1)
|
||||
{
|
||||
*(resultP + charsWritten++) = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return charsWritten;
|
||||
}
|
||||
|
||||
public static string ToDelimitedHexString(this byte[] bytes) => ((ReadOnlySpan<byte>)bytes).ToDelimitedHexString();
|
||||
|
||||
public static unsafe string ToDelimitedHexString(this ReadOnlySpan<byte> bytes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue