forked from engineering/cloudservices
logging
parent
96d47a040c
commit
406ba69637
|
@ -80,11 +80,9 @@ export default class CSCLI {
|
||||||
const parsed: { Username: string, Type: string, Message?: string, Data?: any, HMAC: string } = JSON.parse(args[0]);
|
const parsed: { Username: string, Type: string, Message?: string, Data?: any, HMAC: string } = JSON.parse(args[0]);
|
||||||
// FINISH VERIFICATION CHECKS
|
// FINISH VERIFICATION CHECKS
|
||||||
const handler: Handler = this.handlers.get(parsed.Type);
|
const handler: Handler = this.handlers.get(parsed.Type);
|
||||||
console.log(handler);
|
|
||||||
if (!handler) return socket.destroy();
|
if (!handler) return socket.destroy();
|
||||||
|
|
||||||
const context = new Context(socket, args[0], this.client);
|
const context = new Context(socket, args[0], this.client);
|
||||||
console.log(context);
|
|
||||||
await handler.handle(context);
|
await handler.handle(context);
|
||||||
if (!context.socket.destroyed) {
|
if (!context.socket.destroyed) {
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
|
|
@ -29,8 +29,8 @@ export default class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
public send(v: string) {
|
public send(v: string) {
|
||||||
console.log('writing or whateva');
|
console.log(this.socket);
|
||||||
this.socket.write(`${v.toString()}\n`, (err) => this.client.signale.error(`Error occurred while writing: ${err}`));
|
this.socket.write(`${v.toString()}\n`, (err) => err || this.client.signale.error(`Error occurred while writing: ${err}`));
|
||||||
this.socket.destroy();
|
this.socket.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,7 @@ export default class RAM extends Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async handle(ctx: Context) {
|
public async handle(ctx: Context) {
|
||||||
console.log('1');
|
|
||||||
const memoryConversion = dataConversion(Number(await ctx.client.util.exec(`memory ${ctx.data.username}`)) * 1000);
|
const memoryConversion = dataConversion(Number(await ctx.client.util.exec(`memory ${ctx.data.username}`)) * 1000);
|
||||||
console.log(memoryConversion);
|
|
||||||
return ctx.send(memoryConversion);
|
return ctx.send(memoryConversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue