日志控制

This commit is contained in:
chen wei bo
2025-09-21 20:18:30 +08:00
parent 23c038fd14
commit 8f90c1d7cf
23 changed files with 207 additions and 178 deletions
+8 -6
View File
@@ -1,4 +1,6 @@
import b from "buffer/index.js";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
const { Buffer } = b;
export enum EDeserializeError {
@@ -153,7 +155,7 @@ export default class ByteBuf {
return x
}
else if (h < 0xe0) {
// console.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
// logger.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
this.ensureRead(3)
const x = ((h & 0x1f) << 16) | (buf.readUInt16BE(this._readerIndex + 1))
this._readerIndex += 3
@@ -161,7 +163,7 @@ export default class ByteBuf {
}
else if (h < 0xf0) {
this.ensureRead(4)
// console.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
// logger.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
const x = buf.readInt32BE(this._readerIndex) & 0x0fffffff
this._readerIndex += 4
return x
@@ -194,12 +196,12 @@ export default class ByteBuf {
else if (h < 0xc0) {
this.ensureRead(2)
const x = buf.readUInt16BE(this._readerIndex) & 0x3fff
// console.log(`== read long :${x} index:${this._readerIndex}`)
// logger.log(`== read long :${x} index:${this._readerIndex}`)
this._readerIndex += 2
return x
}
else if (h < 0xe0) {
// console.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
// logger.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
this.ensureRead(3)
const x = ((h & 0x1f) << 16) | (buf.readUInt16BE(this._readerIndex + 1))
this._readerIndex += 3
@@ -207,7 +209,7 @@ export default class ByteBuf {
}
else if (h < 0xf0) {
this.ensureRead(4)
// console.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
// logger.log(`== read ${buf.readInt32BE(this._readerIndex)}`)
const x = buf.readInt32BE(this._readerIndex) & 0x0fffffff
this._readerIndex += 4
return x
@@ -304,7 +306,7 @@ export default class ByteBuf {
// TODO 是否要对 < Number.MAX_SAFE_INTEGER 优化处理?
const xl = buf.readUInt32BE(this._readerIndex + 4)
const xh = buf.readUInt32BE(this._readerIndex) & 0xffffff
// console.log(`== read8 ${xl} ${xh}`)
// logger.log(`== read8 ${xl} ${xh}`)
this._readerIndex += 8
return (BigInt(xh) << BigInt(32)) | BigInt(xl)
}