rm logging
This commit is contained in:
parent
d89fcfb76f
commit
ec035e9a5d
|
@ -21,6 +21,7 @@ export const Lang = {
|
|||
ELIXIR: 0,
|
||||
ERLANG: 1,
|
||||
};
|
||||
const log = (msg) => process.stderr.write(`${msg}\r\n`);
|
||||
export class Bert {
|
||||
allBinariesAsString;
|
||||
mapKeyAsAtom;
|
||||
|
@ -40,7 +41,7 @@ export class Bert {
|
|||
#encode = (obj, buffer) => this[`encode_${typeof obj}`](obj, buffer);
|
||||
encode = (obj, copy = true) => {
|
||||
const tailBuffer = this.#encode(obj, this.outputBuffer.subarray(1));
|
||||
process.stderr.write(`tailbuffer length: ${tailBuffer.length}\n`);
|
||||
log(`tailbuffer length: ${tailBuffer.length}`);
|
||||
if (tailBuffer.length === 0) {
|
||||
throw new Error("Bert encode a too big term, encoding buffer overflow");
|
||||
}
|
||||
|
@ -103,7 +104,6 @@ export class Bert {
|
|||
};
|
||||
encode_string = (obj, buffer) => {
|
||||
if (this.convention === Lang.ELIXIR) {
|
||||
process.stderr.write(`encode string as elixir\n`);
|
||||
return this.encode_binary(Buffer.from(obj), buffer);
|
||||
}
|
||||
else {
|
||||
|
@ -201,7 +201,6 @@ export class Bert {
|
|||
return buffer.subarray(0, 3 + len);
|
||||
};
|
||||
encode_binary = (obj, buffer) => {
|
||||
process.stderr.write(`encode binary\n`);
|
||||
buffer[0] = Types.BINARY;
|
||||
buffer.writeUInt32BE(obj.length, 1);
|
||||
const len = obj.copy(buffer, 5);
|
||||
|
|
|
@ -23,6 +23,8 @@ export const Lang = {
|
|||
ERLANG: 1,
|
||||
} as const;
|
||||
|
||||
const log = (msg: string) => process.stderr.write(`${msg}\r\n`);
|
||||
|
||||
export class Bert {
|
||||
private allBinariesAsString;
|
||||
private mapKeyAsAtom;
|
||||
|
@ -52,7 +54,7 @@ export class Bert {
|
|||
|
||||
encode = (obj: any, copy = true) => {
|
||||
const tailBuffer = this.#encode(obj, this.outputBuffer.subarray(1));
|
||||
process.stderr.write(`tailbuffer length: ${tailBuffer.length}\n`);
|
||||
log(`tailbuffer length: ${tailBuffer.length}`);
|
||||
|
||||
if (tailBuffer.length === 0) {
|
||||
throw new Error("Bert encode a too big term, encoding buffer overflow");
|
||||
|
@ -126,7 +128,6 @@ export class Bert {
|
|||
|
||||
encode_string = (obj: string, buffer: Buffer) => {
|
||||
if (this.convention === Lang.ELIXIR) {
|
||||
process.stderr.write(`encode string as elixir\n`);
|
||||
return this.encode_binary(Buffer.from(obj), buffer);
|
||||
}
|
||||
else {
|
||||
|
@ -237,7 +238,6 @@ export class Bert {
|
|||
};
|
||||
|
||||
encode_binary = (obj: Buffer, buffer: Buffer) => {
|
||||
process.stderr.write(`encode binary\n`);
|
||||
buffer[0] = Types.BINARY;
|
||||
buffer.writeUInt32BE(obj.length, 1);
|
||||
const len = obj.copy(buffer, 5);
|
||||
|
|
Loading…
Reference in New Issue